Logical Operators in C, all in one

C Programming Language / Operators and Enums in C Language

1275

Program:

#include"stdio.h"
void main() {

   int a = 6;
   int b = 25;
   int c ;

   if ( a && b ) {
      printf("Condition is true\n" );
   }
	
   if ( a || b ) {
      printf("Condition is true\n" );
   }
   
   /* lets change the value of  a and b */
   a = 0;
   b = 12;
	
   if ( a && b ) {
      printf("Condition is true\n" );
   }
   else {
      printf("Condition is not true\n" );
   }
	
   if ( !(a && b) ) {
      printf("Condition is true\n" );
   }
	
}

Output:

Condition is true
Condition is true
Condition is not true
Condition is true
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.