Program for Escape Sequence in Java
import java.io.*;
class Escape
{
public static void main(String args[])
{
System.out.println("P Q P&Q P|Q P^Q");
int i,x,y,z;
int p[]={0,0,1,1};
int q[]={0,1,0,1};
for(i=0;i<4;i++)
{
x=p[i]&q[i];
y=p[i]|q[i];
z=p[i]^q[i];
System.out.println(+p[i]+" "+q[i]+" "+x+" "+y+" "+z );
}
}
}
Output
P Q P&Q P|Q P^Q
0 0 0 0 0
0 1 0 1 1
1 0 0 1 1
1 1 1 1 0
class Escape
{
public static void main(String args[])
{
System.out.println("P Q P&Q P|Q P^Q");
int i,x,y,z;
int p[]={0,0,1,1};
int q[]={0,1,0,1};
for(i=0;i<4;i++)
{
x=p[i]&q[i];
y=p[i]|q[i];
z=p[i]^q[i];
System.out.println(+p[i]+" "+q[i]+" "+x+" "+y+" "+z );
}
}
}
Output
P Q P&Q P|Q P^Q
0 0 0 0 0
0 1 0 1 1
1 0 0 1 1
1 1 1 1 0
No comments:
Post a Comment