Write a program to evaluate the series

#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
    clrscr();
    int n,x,sum=1,a,b,p;
    printf("Please Enter the value of x:= ");
    scanf("%d",&x);
    printf("Please Enter the value of n:= ");
    scanf("%d",&n);
   
   
    for(a=1;a<=n;a++)

    {
        p=pow(x,a);
        sum=sum+p;

    }
    printf("Result= %d",sum);
    getch();
}
Next Post Previous Post
No Comment
Add Comment
comment url