Advertisement
2607

Untitled

Sep 9th, 2021
1,341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int a, x, maxd, i=1, f=1, j=1, n;
  6.     scanf("%d",&a);
  7.     while(i<=a)
  8.     {
  9.         x=a;
  10.         n=i;
  11.         while(j<=i)
  12.         {
  13.             while(n>0)
  14.             {
  15.                 n=n-j;
  16.                 if(n==0)
  17.                 {
  18.                     n=-1;
  19.                     j=i+1;
  20.                     i++;
  21.                 }
  22.             }
  23.             j++;
  24.         }
  25.         while(x>0)
  26.         {
  27.             x=x-i;
  28.             if(x==0)
  29.             {
  30.                 maxd=i;
  31.             }
  32.             printf("%d\n", maxd);
  33.         }
  34.         i++;
  35.     }
  36.     printf("%d\n", maxd);
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement