#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>intmain(){int age =17;if(age <18){//多行语句要加 { }printf("未成年\n");printf("不能谈恋爱\n");}elseif(age >=18&& age <28)printf("青年\n");elseif(age >=28&& age <50)printf("壮年\n");elseprintf("老年\n");printf("------------------\n");int a =0;int b =2;if(a ==1){if(b ==2)printf("hehe\n");elseprintf("haha\n");}elseprintf("lalalala\n");printf("------------------\n");//输出1-100的奇数int i =0;while(i<=100){if(i %2==1){printf("%d ", i);}
i++;}printf("\n------------------\n");int day =0;scanf("%d",&day);switch(day){case1:printf("星期一\n");break;case2:printf("星期二\n");break;case3:printf("星期三\n");break;case4:printf("星期四\n");break;case5:printf("星期五\n");break;case6:printf("星期六\n");break;case7:printf("星期天\n");break;default:printf("输入错误\n");break;}printf("------------------\n");int day02 =0;scanf("%d",&day02);switch(day02){case1:case2:case3:case4:case5:printf("工作日\n");break;case6:case7:printf("休息日\n");break;default:printf("输入错误\n");break;}printf("------------------\n");int n =1;int m =2;switch(n){case1:
m++;case2:
n++;case3:switch(n){case1:
n++;case2:
m++;
n++;break;default:break;}case4:
m++;break;default:break;}printf("m = %d, n = %d\n", m, n);//5 3return0;}
未成年
不能谈恋爱
------------------
lalalala
------------------13579111315171921232527293133353739414345474951535557596163656769717375777981838587899193959799------------------1
星期一
------------------2
工作日
------------------
m =5, n =3