#include <iostream>
#include <string>
using namespace std;
int main()
{
int num;
int even_cnt = 0, odd_cnt=0;
cout << "Write any 4 numbers" << endl;;
for (int i=1; i <= 4; ++i) {
cin >> num;
if (num % 2 == 0) {
++even_cnt;
}
else
++odd_cnt;
}
if (even_cnt > odd_cnt) {
cout << "even numbers are more";
}
else if (even_cnt < odd_cnt) {
cout << "odd numbers are more";
}
else
cout << "they are equal";
return 0;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter