【2051】【例3.1】偶数
【题目描述】
读入一个正整数a,如果a为偶数输出yes。
【输入】
一个正整数a。
【输出】
偶数输出yes,否则什么也不输出。
【输入样例】
12
【输出样例】
yes
【程序分析】
【程序实现】
#include <stdio.h>int main() {int a;scanf("%d", &a);// 判断是否为偶数:a % 2 == 0if (a % 2 == 0) {printf("yes\n");}return 0;
}读入一个正整数a,如果a为偶数输出yes。
一个正整数a。
偶数输出yes,否则什么也不输出。
12
yes
【程序分析】
【程序实现】
#include <stdio.h>int main() {int a;scanf("%d", &a);// 判断是否为偶数:a % 2 == 0if (a % 2 == 0) {printf("yes\n");}return 0;
}