题解 | #奇偶统计#
奇偶统计
http://www.nowcoder.com/practice/04de8eb0ecab426fa6be3ae99af17210
while
#include<stdio.h> int main() { int n =0,j=0,s=0; scanf("%d",&n); while(n) { if(n%2==0) ++s; else ++j; --n; } printf("%d %d",j,s); return 0; }
奇偶统计
http://www.nowcoder.com/practice/04de8eb0ecab426fa6be3ae99af17210
#include<stdio.h> int main() { int n =0,j=0,s=0; scanf("%d",&n); while(n) { if(n%2==0) ++s; else ++j; --n; } printf("%d %d",j,s); return 0; }
相关推荐