Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int i,n,x,r=1,sum=0;
- printf("Enter the value of X:");
- scanf("%d",&x);
- printf("\nEnter the value of range for series:");
- scanf("%d",&n);
- for(i=1;i<=n;i++)
- {
- r=r*x;
- sum+=r;
- }
- printf("\nThe sum is:");
- printf("%d\n",sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment