Saturday, September 4, 2010

BlueJ Program On Combination Of Digits

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 PostBlueJ Programs on Number

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner