Skip to main content

examples of logical operator in c

#include <stdio.h>
int main()
{
   int a=5,b=0;
   printf("a&&b= %d\n",a&&b);// if both are non-zero ,condition is true 
   printf("a||b= %d\n",a||b);// if any of a&b are on-zero ,condition is true
   printf("!(a||b)= %d\n",!a||b);// it simply reverse the condition
   
}

Comments