Logical operator : Operator Relation « Language Basics « C / ANSI-C






Logical operator

 #include<stdio.h>
 
 main( ) {
   int c1,c2,c3;
  
   printf("enter value for c1, c2,c3");
   scanf("%d%d%d",&c1,&c2,&c3);
 
   if((c1 < c2)&&(c1<c3))
       printf("\n c1 is less than c2 and c3");
   
   if (!(c1< c2))
       printf("\n c1 is greater than c2");
   
   if ((c1 < c2)||(c1 < c3))
       printf("\n c1 is less than c2 or c3 or both");
}



           
       








Related examples in the same category

1.Testing letters using and
2.Relational and logical operationsRelational and logical operations