3. Write a Program in C to find the sum of the series: (Calculate the factorials using function) (b) S=1 + 1/4 + 1/9 + 1/16 + 1/25 . . .
Answers
Answered by
4
The given problem is solved using language - C.
#include <stdio.h>
int main() {
float sum=0.0,i;
int n;
printf("Enter limit: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
sum+=1/(i*i);
printf("Sum of the series is: %f",sum);
return 0;
}
- The variable 'sum' stores the sum of the series.
- We have asked the user enter the limit.
- Then using a for loop, sum is calculated.
#1
Enter limit: 5
Sum of the series is: 1.463611
————————————————————
#2
Enter limit: 10
Sum of the series is: 1.549768
Attachments:

Similar questions
Math,
2 months ago
Accountancy,
2 months ago
English,
2 months ago
Math,
3 months ago
Physics,
11 months ago
Social Sciences,
11 months ago