Untitled

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

int main()
{
    setlocale(LC_ALL, "Russian");
    int n;
    cin >> n;
    int temp = n;
    int count = 0;
    int digit = 0;
    int summ = 0;
    int nechcount = 0, chcount = 0;
    do {
        digit = temp % 10;
        if (digit % 2 == 0) {
            chcount += 1;
        }
        else {
            nechcount += 1;
        }
        summ += digit;
        temp /= 10;
        count++;
    } while (temp > 0);
    cout << "Нечётных: " << nechcount << endl << "Чётных: " << chcount;
}