draw a flowchart to find the sum of a series up to N
1+x +x*x+x*x*x+x*x*x*x+,----------+xn
Answers
float x,sum,no_row;
int i,n;
printf("Input the value of x :");
scanf("%f",&x);
printf("Input number of terms : ");
scanf("%d",&n);
sum =1; no_row = 1;
for (i=1;i<n;i++)
{
no_row = no_row*x/(float)i;
sum =sum+ no_row;
}
printf("\nThe sum is : %f\n",sum);
}
Copy
Sample Output:
Input the value of x :3
Input number of terms : 5
The sum is : 16.375000
Flowchart:
Flowchart: Calculate the sum of the series [ 1+x+x^2/2!+x^3/3!+....]
C Programming Code Editor:
Improve this sample solution and