Tuesday, February 10, 2015

Harmonic Number Series

#include<stdio.h> #include<conio.h> void main() { double n,sum=0,i; clrscr(); 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 +"); elseif(i==n) printf(" (1/%d) ",i); else printf(" (1/%d) + ",i); } printf("\n\n THE SUM OF THIS SERIES IS %.2lf",sum); getch(); }

Share

& Comment

0 comments:

Post a Comment

 

Copyright © 2015 Code Fervor™ is a registered trademark.

Designed by Templateism By Naman Kumar