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

Popular posts from this blog

example of typecasting in c

/*Type Casting in C Typecasting allows us to convert one data type into other. */ //simple example to cast int value into the float. #include <stdio.h>    int   main (){   float   f = ( float ) 9 / 4 ;     printf ( "f : %f \n " ,  f  );     return   0 ;   }