题解 | #奇偶统计#
奇偶统计
https://www.nowcoder.com/practice/04de8eb0ecab426fa6be3ae99af17210
#include <stdio.h> int main() { int N =0; int x = 0;//表偶数 scanf("%d",&N); for (int i = 1;i<=N ; i++) { if (i%2==0) { x++; } } printf("%d %d",N-x,x); return 0; }
奇偶统计
https://www.nowcoder.com/practice/04de8eb0ecab426fa6be3ae99af17210
#include <stdio.h> int main() { int N =0; int x = 0;//表偶数 scanf("%d",&N); for (int i = 1;i<=N ; i++) { if (i%2==0) { x++; } } printf("%d %d",N-x,x); return 0; }
相关推荐