Monday, May 16, 2016

Find Sum Of Hormonic Series Up To N.



#include<stdio.h>
#include<conio.h>
int main()
{
 double n,sum=0,i;


 printf("\n Please Give The Value of N:  ");
 scanf("%lf",&n);

 for(i=1;i<=n;i++)
 {
  sum = sum + (1/i);
  if(i==1)
   printf("\n 1 +");
  else if(i==n)
      printf(" (1/%f)  ",i);
  else
   printf(" (1/%f) + ",i);
 }

 printf("\n\n THE SUM OF THIS SERIES IS %.2lf",sum);
 getch();
    return 0;
}



Share this

0 Comment to "Find Sum Of Hormonic Series Up To N. "

Post a Comment