Professional Documents
Culture Documents
Practical 8 PDF
Practical 8 PDF
Practical No. – 8
Theory: OR Gate: The function of a logical OR gate efficiently finds the maximum between two
binary digits,
Y=A+B
AND Gate: AND gate is a digital device which produces high output only when all inputs are
high and produces low output at all other inputs conditions.
Y=A.B
NOT Gate: A logic gate which performs the function of logical operator NOT is called as NOT
gate. Some of the function of NOT gate are as follow: It performs a basic logic function
called inversion or complementation.
Y=A’
NAND Gate: It is a combination of an AND gate and NOT gate. If we connect the output of
AND gate to the input of a NOT gate, the gate so obtained is known as NAND gate.
Y= (A.B)’
break;
case 2:
printf("\na b output");
for(int x=0;x<4;x++)
{
int r=a[x]*b[x];
printf("\n%d %d %d",a[x],b[x],r);
}
break;
case 3:
printf("\na b output");
for(int x=0;x<4;x++)
{
if(a[x]==1 || b[x]==1)
printf("\n%d %d 1",a[x],b[x]);
else
printf("\n%d %d 0",a[x],b[x]);
}
break;
case 4:
printf("\na b output");
for(int x=0;x<4;x++)
{
int r=a[x]*b[x];
if(r==1)
printf("\n%d %d 0",a[x],b[x]);
else
printf("\n%d %d 1",a[x],b[x]);
}
break;
case 5:
printf("\na b output");
for(int x=0;x<4;x++)
{
if(a[x]==1 || b[x]==1)
printf("\n%d %d 0",a[x],b[x]);
else
printf("\n%d %d 1",a[x],b[x]);
}
break;
case 6:
printf("\na b output");
for(int x=0;x<4;x++)
{
if(a[x]==1 && b[x]==1)
printf("\n%d %d 0",a[x],b[x]);
else if(a[x]==0 && b[x]==0)
printf("\n%d %d 0",a[x],b[x]);
else
printf("\n%d %d 1",a[x],b[x]);
}
break;
case 7:
printf("\na b output");
for(int x=0;x<4;x++)
{
if(a[x]==1 && b[x]==1)
printf("\n%d %d 1",a[x],b[x]);
else if(a[x]==0 && b[x]==0)
printf("\n%d %d 1",a[x],b[x]);
else
printf("\n%d %d 0",a[x],b[x]);
}
break;
default:
printf("\nInvalid Choice");
}
}
Output: