Answers for "relational operator in c"

C
0

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 bn”);
}else{
 printf(“a is not equal to bn”);
}

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

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

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

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

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

}
Posted by: Guest on January-08-2022
0

Logical Operator in C language

#include<stdio.h>
int main(){
  A = 5;
  B = 10;
if((A == 5) && (B < 11)){
 printf(“Both conditions are ture”);
}

if(!(A==5)){
 printf(“A is not equal to 5”);
}

if((A>=3) ||(B<=9)){
 printf(“min any one condition is true”);
}

}
Posted by: Guest on January-08-2022

Code answers related to "C"

Browse Popular Code Answers by Language