by Dinesh Thakur Category: Control Structures

C program to sum the series 1/12+1/22+1/32

#include <stdio.h>

#include <math.h>
#include <conio.h>
main()
{
  int number;
  float sum=0.0, num1, num2;
  clrscr();
  printf("\n Enter the value of n: ");
  scanf(" %d", &number);
  for(num2=1.0;num2<=number;num2++)
   {
      num1=1/pow (num2,2);
      sum = sum +num1;
   }
     printf("\n The sum of series 1/12 + 1/ 22 +....1/n2 = %f", sum);
     return 0;
}

sum the series

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content





Popular Article