Untitled
Anonymous
c_cpp
10/12/2023 5:59 PM
408 B
19
Indexable
#include <iostream>
using namespace std;
int main()
{
int a;
int even = 0;
int odd = 0;
cin >> a;
if (a == 0) {
even = 1;
}
else {
while (a != 0) {
if (a % 10 % 2 == 0) {
even++;
}
else {
odd++;
}
a /= 10;
}
}
cout << even << ' ' << odd;
}Editor is loading...