Source Code :
#include<stdio.h>
#include<math.h>
void main()
{
      int x,n,i,j;
      float sum=1;
      printf("\nEnter the Value of 'x' : ");
      scanf("%d",&x);
      printf("\nEnter the Value of 'n' : ");
      scanf("%d",&n);
      for(i=1;i<=n;i++)
      {
            sum+=pow(x,i);
      }
      printf("\nSum of the Series : %5.2f",sum);
      getch();
}
Output : 
Enter the Value of ‘x’ : 2
Enter the Value of ‘n’ : 5
 
 
 
No comments:
Post a Comment