Professional Documents
Culture Documents
Ips 2.2
Ips 2.2
7\11\22
22 CSH 101
int i=1;
float fact=1,expo=0;
float sum=1;
while(i<terms)
{
fact = fact*i;
expo = pow(num,i);
sum += expo/fact;
i++;
}
printf("the sum of series e^x is %.1f",sum);
}
No error
We use integer i from 1 till no of terms inputted by user and run a loop with it and we calculate answer in
two parts where one is used for factorial and one for power calculation and at end we add it to sum and
sum keeps on adding new value till i reaches 1 less than terms and it exists because first term is 1 which
is added already