answersLogoWhite

0


Best Answer

#include(stdio.h) // place this '<' & '>' instead of '(' & ')' before stdio.h

#include(conio.h)

#include(math.h)

int main( )

{

int x, n, sum,power;

clrscr( );

printf("Enter the values of x and n:");

scanf("%d%d", &x, &n);

if(n<0 style="font-weight: bold; color: rgb(255, 0, 0);">

{

printf("\nSorry, the formula does not make sense for negative exponents & values");

printf("Enter the values of x and n:");

scanf("%d%d", &x, &n);

sum=1;

for(power=1; power <=n; power++) {

sum=sum+ pow(x,power); }

printf("X value is: %d \nN value is: %d", x, n);

printf("\nSum of the given geometric progression: %d", sum);

}

else

{

sum=1;

for(power=1; power <=n; power++) {

sum=sum+ pow(x,power); }

printf("X value is: %d \nN value is: %d", x, n);

printf("\nSum of the given geometric progression: %d", sum);

}

getch( );

return 0;

}

User Avatar

Wiki User

āˆ™ 12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to find the geometric progression in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you find the ratio in the geometric progression?

Divide any term, except the first, by the term before it.


Formula to find out the sum of n terms?

It is not possible to answer this question without information on whether the terms are of an arithmetic or geometric (or other) progression, and what the starting term is.


How do you write Square program using vb?

write a vb program to find the magic square


How do you write socket program in c?

For first find an example program.


Write a program to find the grade obtained by the students of a class using structure?

Write a program to find the grade obtained by the students of a class


Write a c program to find eigenvalue of a matrix?

Yes, do write. That's what you always have to do when you have got a homework-program.


How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


The first and fourth terms of a geometric progression are 54 and 2 respectively Find the sum to infinity of the geometric progression?

t(1) = a = 54 t(4) = a*r^3 = 2 t(4)/t(1) = r^3 = 2/54 = 1/27 and so r = 1/3 Then sum to infinity = a/(1 - r) = 54/(1 - 1/3) = 54/(2/3) = 81.


Write a c program to find Volume and surface area of cube?

Write a c program to compute the surface area and volume of a cube


A geometric progression has a common ratio -1/2 and the sum of its first 3 terms is 18. Find the sum to infinity?

The sum to infinity of a geometric series is given by the formula Sāˆž=a1/(1-r), where a1 is the first term in the series and r is found by dividing any term by the term immediately before it.


How to write a C program to find largest 2 numbers using pointers?

program to find maximum of two numbers using pointers


How do you write a java program to find the ad joint of a matrix?

bgfygfrhjyuyhh