package com.wxy002;
/*
* 有1、2、3、4 四个数字,编程实现能组成多少个互不相同且无重复数字的三位数?都是多少?
*/
public class Test33
{
public static void main(String[] args)
{
int count = 0;
int n = 0;
for(int i = 1 ;i<=4; i++)
{
for(int j = 1;j<=4;j++)//个位
{
for(int k =1; k<=4;k++)//十位
{
if (i != j && j != k && i != k)//百位
{
count++;//计数器,计算个数
n = i + j*10 + k*100;
System.out.print(n+"----");
System.out.println(count);
}
}
}
}
}
}
|
|