int n, count_even = 0, count_odd = 0;
int h, t, u, sum = 0;
cout << "Enter input : ";
cin >> n;
h = n % 1000 / 100;
t = n % 100 / 10;
u = n % 10 / 1;
sum = h + t + u;
cout << h << "+" << t << "+" << u << "= " << sum << endl;
if (h % 2 == 0)
{
count_even++;
}
else
{
count_odd++;
}
if (t % 2 == 0)
{
count_even++;
}
else
{
count_odd++;
}
if (u % 2 == 0)
{
count_even++;
}
else
{
count_odd++;
}
cout << "Even = " << count_even << endl;
cout << "Odd = " << count_odd << endl;
ไม่มีความคิดเห็น:
แสดงความคิดเห็น