Description
编写程序:输入一个整数代表年龄,如果年龄在0至150之间(包括0和150),则打印输出"Yes";如果输入的年龄不在0至150之间,则要求输出"Exception"。Input
有多组测试数据,每组数据为单独的一行,一个整数N(-1000 ≤ N ≤ 10000)表示所给的年龄。Output
如果所给年龄在0-150之间输出"Yes",否则输出"Exception"。Sample Input
0
120
150
-150
Sample Output
Yes
Yes
Yes
Exception
#include #include int main(){ int n; while(scanf("%d",&n)!=EOF){ if(n>=0 && n<=150){ printf("Yes\n"); }else{ printf("Exception\n"); } } }