Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int max(int a, int b)
  5. {
  6. if(a>b)
  7. {
  8. return a;
  9. }
  10. return b;
  11. }
  12.  
  13. int golemacifra(int n)
  14. {
  15.  
  16. int cifra;
  17. cifra=n%10;
  18.  
  19.  
  20. if(n/10==0)
  21. {
  22. return cifra;
  23. }
  24.  
  25. return max(cifra, golemacifra(n/10));
  26.  
  27. }
  28.  
  29.  
  30. int main()
  31. {
  32. int n;
  33. for(;scanf("%d",&n);)
  34. {
  35. printf("%d\n" ,golemacifra(n));
  36. }
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement