有1、2、3、4四个数,能组成多少个互不相同且无重复数字的三位数,都是多少
public class Programming11 {
public static void main(String[] args) {
int count = 0;
for (int i = 1; i <= 4; i++) {
for (int j = 1; j <= 4; j++) {
for (int k = 1; k <= 4; k++) {
if (k != i && k != j && i != j) {
int num = i * 100 + j * 10 + k;
count++;
System.out.print(num + "\t");
}
}
}
}
System.out.println("\n共能组成" + count + "个数");
}
}
代码小兵64503-29 11:46
代码小兵87208-06 11:36
代码小兵34507-29 13:19