Advertisement
Yuuouji

Bai06: S(n)= 1/1*2 + 1/2*3 + ... + 1/(n*(n+1)).

Oct 6th, 2014
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. // Bai06: S(n)= 1/1*2 + 1/2*3 + ... + 1/(n*(n+1)).
  2.  
  3. #include<stdio.h>
  4. #include<conio.h>
  5.  
  6. void main()
  7. {
  8. float S = 0 ;
  9. int i , n ;
  10. printf("nhap n : ");
  11. scanf("%d",&n);
  12. for ( i = 1 ; i <= n ; i++ )
  13. S += (float)1/(i*(i+1)) ;
  14. printf("tong la : %f",S);
  15. getch();
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement