题解 | #奇偶统计#
奇偶统计
http://www.nowcoder.com/practice/04de8eb0ecab426fa6be3ae99af17210
int main()
{
int a = 1;
int b = 0;
int c = 0, d = 0;
scanf("%d", &b);
for (; a <= b; a++)
{
if (a % 2 != 0)
{
c++;
}
else if (a % 2 == 0)
{
d++;
}
}
printf("%d %d", c, d);
return 0;
}