📜  C语言中的关系运算符 - C编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:34.554000             🧑  作者: Mango

代码示例1
#include
int main(){

int a = 20;
int b = 10;
int c;

// == operator
if(a == b){
 printf(“a is equal to b\n”);
}else{
 printf(“a is not equal to b\n”);
}

// > operator
if(a > b){
 printf(“a is greater than b\n”);
}else{
 printf(“a is not greater than b\n”);
}

// < operator
if(a < b){
 printf(“a is less than b\n”);
}else{
 printf(“a is not less than b\n”);
}

// != Opertor
if(a != b){
 printf(“a is not equal to b\n”);
}else{
 printf(“a is equal to b\n”);
}

// >= orperator
if(a >= b){
 printf(“a is greater than or equal to b\n”);
}else{
 printf(“a is not greater than or equal to b\n”);
}

// <= operator
if(a <= b){
 printf(“a is less than or equal to b\n”);
}else{
 printf(“a is not less than or equal to b\n”);
}

}