Untitled
пкупукпunknown
c_cpp
2 years ago
455 B
7
Indexable
#include <iostream>
#include <string>
using namespace std;
int main()
{
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 << "nechet: " << nechCount << ", chent: " << chCount;
}Editor is loading...