C program to print the LOgic gates(AND, OR, NOT, NAND, NOR, XOR). take input from the user.
code👇👇👇👇👇👇👇👇👇
#include<stdio.h>
int main()
{
int a,b;
printf("Enter input a=");
scanf("%d",&a);
printf("Enter input b=");
scanf("%d",&b);
printf("a AND b = %d\n",a&b);
printf("a OR b = %d\n",a|b);
printf("NOT a = %d\n",!a);
printf("a NAND b = %d\n",!(a&b));
printf("a NOR b = %d\n",!(a|b));
printf("a XOR b = %d\n",a^b);
return 0;
}
No comments:
Post a Comment