
C programme to print the sum of 1+1/sqr(2)+1/sqr(3)+....
#include<stdio.h> #include<conio.h> #include<math.h> int main() { int term,i=1; float sqr=0.0; printf("Enter number of terms you want"); scanf("%d",&term); while(i<=term) { sqr=sqr+(float)1/pow(i,2); i++; } printf("\nThe ans is %f",sqr); }
0 comments:
Post a Comment