Advertisement
PROFESSOR_AIH

Exceeding Z

Apr 8th, 2022
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int x,z,sum=0,count=0;
  5.     scanf("%d",&x);
  6.     while(1)
  7.     {
  8.         scanf("%d",&z);
  9.         if(z<=x)
  10.             continue;
  11.         else
  12.         {
  13.             while(1)
  14.             {
  15.                 sum=sum+x;
  16.                 count++;
  17.                 if(sum>=z)
  18.                     break;
  19.                 else
  20.                     x++;
  21.             }
  22.             break;
  23.         }
  24.     }
  25.     printf("%d\n",count);
  26.  
  27.     return 0;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement