Advertisement
Guest User

Untitled

a guest
Sep 26th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. int nrmaxim(int n)
  2. {
  3. int i=0,poz=0,cn,m=0,p=1,nrc=0;
  4. cn=n;
  5. while(cn)
  6. {
  7. nrc++;
  8. cn/=10;
  9. }
  10. for(i=1;i<nrc;i++)
  11. p*=10;
  12. for(i=1;i<=nrc;i++)
  13. {
  14. poz=n/p;
  15. n=n%p;
  16. n=n*10+poz;
  17. if(n>m)
  18. m=n;
  19. }
  20. return m;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement