answersLogoWhite

0

#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

13y ago

What else can I help you with?

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


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

program to find maximum of two numbers using pointers


Write the program in Linux to find the reverse of any string?

i am sam


Write a C program to find sum of 3 matrices?

matrix