c语言用while或者do-while或者用for语句求1-100之间奇数的个数

如题所述

#include <stdio.h>
int main()
{
int i,n;
n=0;
for(i=1;i<100;i++)
{
if(i%2 != 0)
n++;
}
printf("1-100之间奇数的个数= %d\n",n);
return 0;
}
温馨提示:答案为网友推荐,仅供参考
相似回答