Home C Language Basic C Programs Geometric progression

Geometric progression

Write a C program to read in two numbers, x and n, and then compute the sum of this geometric progression: 1+x+x2+x3+………….+xn.


int main()


   int x,n,i;

   long int s=1;

   printf(“Enter x, n values : “);




   printf(“Result = %ld\n”,s);

   return 0;



Enter x, n values : 10   6

Result = 1111111