#include(stdio.h)
#include(conio.h)
#include(math.h)
int main( )
{
int i, x, n;
float sum, p;
clrscr( );
printf("Enter the base value 'x':");
scanf("%d", &x);
printf("\nEnter the power value 'n':");
scanf(" %d", &n);
sum=1;
for( i=1; i<=n ; i++)
{
p=pow(x, i);
sum=sum+(1/p);
}
printf("\nSum of the series: %f", sum);
getch( );
return 0;
}
Note:- if u have any douts regarding this program, please feel free to contact.
No comments:
Post a Comment