Tag Archives: Truth Table

Write a C++ & Python Program to print the truth table for XY+Z

Here in this program, we will write a code that will print the truth table for XY+Z. Truth Table for XY+Z C++: #include<iostream.h> #include< conio.h> #include<stdio.h> #include<math.h> void main() { clrscr(); int a,b,c; cout<<“A\tB\tC\tAB+C”; for(a=0;a<=1;a++) for(b=0;b<=1;b++) for(c=0;c<=1;c++) { if(a*b+c==2) cout<<“\n\n”<<a<<“\t”<<b<<“\t”<<c<<“\t”<<“1”; else cout<<“\n\n”<<a<<“\t”<<b<<“\t”<<c<<“\t”<<a*b+c; } getch(); } Output: A       B       C       AB+C 0       0       0       0 0       0       1       1… Read More »