Lucian_Adrian

#68 CifraMaxima

Oct 19th, 2021
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n;
  7. cin >> n;
  8. int cmax= n%10;
  9.  
  10. while(n)
  11. {
  12.  
  13. if(n%10>cmax)
  14. cmax = n%10;
  15. n /= 10;
  16. }
  17.  
  18. cout << cmax << endl;
  19.  
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment