Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Khai bao ham thu vien neu co
- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- int n;
- scanf("%d",&n);
- float s=0;
- if(n==0)
- {
- printf("1");
- }
- else
- {
- for(int i=1;i<=n;i+=2)
- {
- s=s+ (float)1/((2*i)+1);
- }
- printf("%.3f\n",s);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement