C语言中 B大于A小于C 如何表示?

如题所述

可以表示为:a>b && a<c
举个例子:

#include <stdio.h> 
int main(){
int a,b,c;
a=10;b=20;c=30;
if (a>b && a<c)
    printf("1.This is: a>b and a<c\n");
else
    printf("1.This is not: a>b and a<c\n");
    
a=25;b=20;c=30;
if (a>b && a<c)
    printf("2.This is: a>b and a<c\n");
else
    printf("2.This is not: a>b and a<c\n");
}

执行的效果如下:

温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-07-15
C语言中没有像数学中那样的连续不等号,需要把两个条件分开,然后用逻辑与把条件连接起来,代码如下:
B>A&&B<C
第2个回答  推荐于2017-06-27
B>A&&B<C

本回答被网友采纳
第3个回答  2016-10-18
B>A&&B<C