Lucian_Adrian

#3665 cmmcp

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