Step 1: Start
Step 2: Initialize a=0andb=1
Step 3: Print the values of aandb
Step 4: Print the results of boolean operations
(a|b),(a & b),(a ^ b),(a||b),and(a && b)
Step 5: End
kw.c
#include<stdio.h>intmain(){inta=0,b=1;printf("———————————————————————————————————————————");printf("\nProgram to perform boolean operations");printf("\n———————————————————————————————————————————");printf("\nValue of a | %d ",a);printf("\nValue of b | %d ",b);printf("\nValue of %d | %d | %d ",a,b,(a|b));printf("\nValue of %d & %d | %d ",a,b,(a&b));printf("\nValue of %d ^ %d | %d ",a,b,(a^b));printf("\nValue of %d|| %d | %d ",a,b,(a||b));printf("\nValue of %d&& %d | %d ",a,b,(a&&b));printf("\n———————————————————————————————————————————\n");return0;}
Output
kodingwindow@kw:~$ gcc kw.c kodingwindow@kw:~$ ./a.out
———————————————————————————————————————————
Program to perform boolean operations
———————————————————————————————————————————
Value of a | 0
Value of b | 1
Value of 0 | 1 | 1
Value of 0 & 1 | 0
Value of 0 ^ 1 | 1
Value of 0|| 1 | 1
Value of 0&& 1 | 0
———————————————————————————————————————————
kodingwindow@kw:~$
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.