Advertisement
Sabbir-bin

sum of 1/5+2/10+....999/4995+ 1000/5000 =

Dec 6th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.   int i =1 , c=0 , sum=0 ,a , k=5;
  5.   while(i <= 1000)
  6.   {
  7.      c=c+1;
  8.  
  9.      printf ("%d", i);
  10.    printf("/%d = \n\n", k);
  11.    sum = sum+a;
  12.  
  13.     k = k+5;
  14.     a =i/k;
  15.    i++;
  16.      
  17.   }
  18.   printf("\nThe sum value are = %d\n", sum);
  19.  
  20.    
  21.   printf("\nThe number of digits = %d", c);
  22.   printf("\n\n");
  23.   return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement