C语言中判断奇数偶数
C语言中判断奇数偶数
操作方法
- 01
定义x int x;
- 02
输出 Please input a number printf("Please input a number: ");
- 03
获取键盘中输入的字符 scanf("%d",&x);
- 04
条件判断并输出 if(x%2==0) printf("this is a oushu!"); else printf("this is a jishu!");
- 05
完整代码#include <stdio.h>main(){ int x; printf("Please input a number: "); scanf("%d",&x); if(x%2==0) printf("this is a oushu!"); else printf("this is a jishu!");}
赞 (0)