#include <stdio.h> #include <stdlib.h> int main() { int x; printf("输入一个整数: \n"); scanf("%d",&x); int y; y = x%2; if( y == 1) printf("是奇数"); else printf("是偶数"); system("pause"); return 0; }
#include <stdio.h> #include <stdlib.h> int main() { int days; printf("输入一个整数: \n"); scanf("%d",&days); if(1<=days,days<=5) printf("workdays, fighting\n"); else if(6<=days,days<=7) printf("weekend, relax~\n"); else printf("Ooops, not in 1~7\n"); system("pause"); return 0; }
#include <stdio.h> #include <stdlib.h> int main() { char ch; printf("输入一个字符:\n"); scanf("%c",&ch); if('a'<=ch&&ch<='z') ch = ch - 32; printf("%c\n",ch); system("pause"); return 0; }