题目:有任意三个小于10,且各不相同的正整数,能组成多少个互不相同且无重复数字的三位数,都是多少,一共有多少个。
package New.Week1.Combination;
import java.util.Scanner;
public class test {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int Shu[] = new int[3];
int i,j,k,count = 0;
for(i = 0;i < 3;i++){
Shu[i] = scan.nextInt();
}
for(i = 0;i < 3;i++){
for(j = 0;j < 3;j++){
for(k = 0;k < 3;k++) {
if(Shu[i]!=Shu[j] && Shu[i]!=Shu[k] && Shu[j]!=Shu[k]){
int num = Shu[i]*100 + Shu[j]*10 + Shu[k];
count++;
System.out.print(num+"\t");
}
}
}
}
System.out.println();
System.out.println("一共能组成:"+count+"个");
}
}