xachetbay

1 + 1/n

Mar 13th, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.18 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<conio.h>
  3. int main()
  4. {
  5.     float m;
  6.     printf("Nhap n: "); int n; scanf("%d",&n);
  7.    
  8.     for (float i = 1;i<=n;i++){
  9.         m = m + 1/i;
  10.     }
  11.     printf("KQ = %f",m);
  12.    
  13. }
Advertisement
Add Comment
Please, Sign In to add comment