【程序11】
题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
public class B_11 {
public static void main(String[] args) {
int i,j,k;
int count1=0;
int count2=0;
for(i=1;i<=4;i++){
for(j=1;j<=4;j++){
if(i != j){
for(k=1;k<=4;k++){
if(j != k && i != k){
System. out. print(i);
System. out. print(j);
System. out. print(k);
count1++;
count2++;
if(count1 == 6){
System. out. print("\n");
count1 =0;
}else{
System. out. print(" ");
}
}
}
}
}
}
System.out.print("组合一共有 "+count2+" 种");
}
}