Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

Relational Operator in C language

#include<stdio.h>
int main(){

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

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

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

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

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

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

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

}
Source by techtechinfo.com #
 
PREVIOUS NEXT
Tagged: #Relational #Operator #C #language
ADD COMMENT
Topic
Name
9+5 =