Here is a BlueJ program which displays the different combination of 3 digits - 1,2 and 3.
The combination of the digits will be 123,132,213,231,312,321
class P
{
public void show()
{
int i, x=1,y=2,z=3,t,n=3,j;
for (i=1; i<=n; i++)
{
t=x;
x=y;
y=z;
z=t;
for(j=1;j< n;j++) {
t=y;
y=z;
z=t;
System.out.print( x);
System.out.print( y);
System.out.print( z);
System.out.println();
}
}
}
public static void main(String args[])
{
BlueJP ob=new BlueJP();
ob.show();
}
}
Related Post: BlueJ Programs on Number
The combination of the digits will be 123,132,213,231,312,321
class P
{
public void show()
{
int i, x=1,y=2,z=3,t,n=3,j;
for (i=1; i<=n; i++)
{
t=x;
x=y;
y=z;
z=t;
for(j=1;j< n;j++) {
t=y;
y=z;
z=t;
System.out.print( x);
System.out.print( y);
System.out.print( z);
System.out.println();
}
}
}
public static void main(String args[])
{
BlueJP ob=new BlueJP();
ob.show();
}
}
Related Post: BlueJ Programs on Number
No comments:
Post a Comment