题解 | #奇偶统计#
奇偶统计
http://www.nowcoder.com/practice/04de8eb0ecab426fa6be3ae99af17210
#include <stdio.h>
int main(){
long int a;
long int i;
long int countz=0;
long int countf=0;
scanf("%ld",&a);
for(i=0;i<a;i++){
i=i+1;
if(i%2!=0){
countf=countf+1;
}
}
printf("%ld %ld",countf,a-countf);
}
int main(){
long int a;
long int i;
long int countz=0;
long int countf=0;
scanf("%ld",&a);
for(i=0;i<a;i++){
i=i+1;
if(i%2!=0){
countf=countf+1;
}
}
printf("%ld %ld",countf,a-countf);
}