求大神相救!!调用自定义函数判断数的奇偶性,求奇数和,帮我看看代码错在那里了,感激不尽
#include<stdio.h>intmain(void){inti,sum=0;inteven(intn);printf("Inputintegers:");scan...
#include<stdio.h>
int main(void)
{
int i,sum=0;
int even(int n);
printf("Input integers:");
scanf("%d",&i);
while(i>0){
if(even(i) == 0){
sum = sum + i;
scanf("%d",&i);
}
printf("The sum of the odd numbers is %d\n",sum);
return 0;
}
int even(int n)
{
if(n%2 == 0)
return 1;
else
return 0;
} 展开
int main(void)
{
int i,sum=0;
int even(int n);
printf("Input integers:");
scanf("%d",&i);
while(i>0){
if(even(i) == 0){
sum = sum + i;
scanf("%d",&i);
}
printf("The sum of the odd numbers is %d\n",sum);
return 0;
}
int even(int n)
{
if(n%2 == 0)
return 1;
else
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询