Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
375 B
1
Indexable
Never
#include <iostream>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int kol = 0;
    int sum = 0;
    int max = -1;
    while (n != 0) {
        if (n % 10 > max) {
            max = n % 10;
        }
        sum += n % 10;
        kol+= 1;
        n = n / 10;
       
        
   }
    if(sum%2==0 && kol<=4)
     cout << max;

}

Leave a Comment