Created
August 10, 2017 17:08
-
-
Save echo-akash/68387468ce0a6c3d30fb9c5b7e29b6bb to your computer and use it in GitHub Desktop.
Print the sum of the series: 1+1/3+1/5+...+1/N=?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
double n,sum=0,i; | |
printf("Please Give The Value of N: "); | |
scanf("%lf",&n); | |
for(i=1;i<=n;i=i+2) | |
{ | |
sum = sum + (1/i); | |
} | |
printf("sum=%.2lf",sum); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment