巧乐兹_d41f

关注

if . else .if else 的使用

巧乐兹_d41f

关注

阅读 62

2022-08-03

#include<stdio.h>

int main()

{

int a = 0;

scanf_s("%d", &a);           //&不能漏

if(a<18)

 printf("青年\n");

else if (a >= 18 && a < 40)    //不能用18<=a<40

 printf("中年\n");

else  

 printf("老年\n");





备注:if 只会和他最接近的else搭配








return 0;

}


相关推荐

witmy

if、else、else if使用方法

witmy 49 0 0

古月无语

C语言的if和if else、if...else if、语句以及嵌套使用

古月无语 182 0 0

水沐由之

python的for else用法和while else用法

水沐由之 45 0 0

程序员漫画编程

js中的分支语句if…else if…else应用

程序员漫画编程 67 0 0

eelq

JSTL 的 if else : 有 c:if 没有 else 的处理

eelq 69 0 0

热爱生活的我一雷广琴

简单的if else

热爱生活的我一雷广琴 73 0 0

茗越

mysql的if else

茗越 66 0 0

云卷云舒xj

js一行If ... else ... else if语句

云卷云舒xj 123 0 0

孟祥忠诗歌

陈旧语法密度之八——使用多态消灭if-else if-else

孟祥忠诗歌 217 0 0

闲嫌咸贤

cmake if-else- else-endif 条件语句

闲嫌咸贤 89 0 0

精彩评论(0)

0 0 举报