Showing posts with label xy. Show all posts
Showing posts with label xy. Show all posts
Monday, February 16, 2015
C program to print the truth table for XY Z
#include<stdio.h>
#include<conio.h>
void main()
{
int x,y,z;
clrscr(); //to clear the screen
printf("X Y Z XY+Z");
for(x=0;x<=1;++x)
for(y=0;y<=1;++y)
for(z=0;z<=1;++z)
{
if(x*y+z==2)
printf("
%d %d %d 1",x,y,z);
else
printf("
%d %d %d %d",x,y,z,x*y+z);
}
getch(); //to stop the screen
}
Tuesday, February 10, 2015
C program to print truth table of XY Z

#include<iostream.h>
#include<conio.h>
void main()
{
int x,y,z;
clrscr();
cout<<"X Y Z XY+Z";
for(x=0;x<=1;++x)
for(y=0;y<=1;++y)
for(z=0;z<=1;++z)
{
if(x*y+z==2)
cout<<"
"<<x<<" "<<y<<" "<<z<<" 1";
"<<x<<" "<<y<<" "<<z<<" 1";
else
cout<<"
"<<x<<" "<<y<<" "<<z<<" "<<x*y+z;
"<<x<<" "<<y<<" "<<z<<" "<<x*y+z;
}
getch();
}
Subscribe to:
Posts (Atom)