Question Address: https://www.patest.cn/contests/gPlt/L1-022
Question:
Given N positive integer, please count the odds and even numbers?
Input format:
Input the first line to give a positive N (<= 1000); the second line gives N positive integer, separated by spaces.
output format:
In the line, the number of strange numbers, the number of even numbers. The middle is separated by 1 space.
Input sample:
9 88 74 101 26 15 0 34 22 77
output sample:
3 6
code:
#include<iostream>
using namespace std;
int main()
{
int n,i;
cin>>n;
int number;
int ji=0,ou=0;
for(i=0;i<n;i++)
{
cin>>number;
if(number%2==0)ou=ou+1;
else ji=ji+1;
}
cout<<ji<<" "<<ou<<endl;
return 0;
}