Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. int nrmaxim(int n){
  2.     static int x = 1;
  3.  
  4.     static int maxi = n;
  5.     static int mas = n;
  6.  
  7.     while(n/x>10)
  8.     {
  9.         x *= 10;
  10.     }
  11.     n = (n%10) * x + n/10;
  12.  
  13.     if(maxi < n)
  14.     {
  15.         maxi = n;
  16.     }
  17.     if(mas==n)
  18.     {
  19.         return maxi;
  20.     }
  21.  
  22.     return nrmaxim(n);
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement