编程从键盘输入一个正整数n,判断该数的奇偶性,若为奇数输出“odd”,若为偶数输出“even”
程序员文章站
2022-07-15 12:21:25
...
#include "stdio.h"
int main(void)
{
int n = 0;
printf("please input a number:");
scanf_s("%d", &n);
if (0 == n % 2)
printf("even\n");
else
printf("odd\n");
return 0;
}