用C语言输入一段整数当输入到0时输入终止 计算这段数中奇数偶数各多少#includevoid main(){int a=0;int b;int c=0;scanf("%d",&b);while(b!=0){\x05if(b%2==0)\x05a++;\x05else c++;\x05}printf("The number O is %d,J is %d",a,c);prin
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/20 09:22:22
用C语言输入一段整数当输入到0时输入终止 计算这段数中奇数偶数各多少#includevoid main(){int a=0;int b;int c=0;scanf("%d",&b);while(b!=0){\x05if(b%2==0)\x05a++;\x05else c++;\x05}printf("The number O is %d,J is %d",a,c);prin
用C语言输入一段整数当输入到0时输入终止 计算这段数中奇数偶数各多少
#include
void main()
{
int a=0;
int b;
int c=0;
scanf("%d",&b);
while(b!=0)
{
\x05if(b%2==0)
\x05a++;
\x05else
c++;\x05
}
printf("The number O is %d,J is %d",a,c);
printf("Done\n");
} 麻烦大家看看我的程序哪里有问题 为什么出不了结果
c++;后面还有一段 scanf("%d",&b); 刚才漏删了
用C语言输入一段整数当输入到0时输入终止 计算这段数中奇数偶数各多少#includevoid main(){int a=0;int b;int c=0;scanf("%d",&b);while(b!=0){\x05if(b%2==0)\x05a++;\x05else c++;\x05}printf("The number O is %d,J is %d",a,c);prin
#include
void main()
{
int a=0;
int b;
int c=0;
do
{
\x05scanf("%d",&b);
\x05if(b != 0)
\x05{
\x05\x05if(b%2 == 0)
\x05\x05\x05a++;
\x05\x05else
\x05\x05\x05c++;\x05
\x05}
}while(b != 0);
printf("The number O is %d,J is %d",a,c);
printf("Done\n");
} 这样就好了.获取b你要放在循环里面.