输入整数a,如果该数为0则输出“zero”,否则判断奇偶性,若为奇数则输出“odd”,若为偶数则输出“even”

补考的题目求帮忙啊~

C语言的如下
#include<stdio.h>
main()
{
int x;
printf("输入一个整数:");
scanf("%d",&x);
if(x==0)
printf("zero\n");
else if(x%2==0)
printf("even\n");
else
printf("odd\n");
}

C++语言的如下
#include<iostream.h>
void main()
{
int x;
cout<<"输入一个整数:";
cin>>x;
if(x==0)
cout<<"zero"<<endl;
else if(x%2==0)
cout<<"even"<<endl;
else
cout<<"odd"<<endl;
}
温馨提示:答案为网友推荐,仅供参考
相似回答