不是同一个意思吗
程序代码:
#include<stdio.h>
int main(void)
{
int man,oz,op,jz,jp; //man输入数值,OZ偶数总个数,OP偶平均数,JZ奇数,JP奇平均数//
oz=0;
op=0;
jz=0;
jp=0;
while((scanf("%d",&man) != 0 ))//这个//
{
if(man%2==0)
{
oz++;
}
else
{
jz++;
}
}
printf("偶数总个数%d,偶数平均数%d,奇数总个数%d,奇数平均数%d",oz,op,jz,jp);
return 0;
程序代码:
#include<stdio.h>
int main(void)
{
int i_even = 0, sum_even = 0, i_odd = 0, sum_odd = 0, num;
printf("请输入数值 (0 退出):");
while(1)
{
scanf("%d",&num);
if (num == 0)
break;//这个//
if (num % 2 == 0)
{
i_even++;
sum_even += num;
}
else
{
i_odd++;
sum_odd += num;
}
}
printf("偶数的个数: %d\n",i_even);
printf("偶数的总和: %d\n",sum_even);
printf("奇数的个数: %d\n",i_odd);
printf("奇数的总和: %d\n",sum_odd);
return(0);
}
不是同一个意思吗,为什么第一个就运行有问题,另外各位大神能不能讲的详细点。






