adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Program in C to print truth table using logical operators


Program in C to print truth table using logical operators



#include<stdio.h>
#include<conio.h>
   void main()
     {
      int a,b,temp,i;
      clrscr();
      printf("\tA   B   A.B  A+B  A'\n");
      for(i=0;i<4;i++)
        {
          temp=i;
          a=i%2;
          temp/=2;
          b=temp%2;
          printf("\n\t%d    %d    %d   %d   %d\n",b,a,a&&b,a||b,!b);
         }
  getch();
  }

Output :-


Related programs


Post a Comment

1 Comments