注意百位不能为0;
编译环境:vc++6.0
#include <stdio.h>
/*穷举*/
int main()
{
int x;
for (int i = 1; i <= 4; i++)
for (int j = 0; j <= 4; j++)
{
for (int k = 0; k <= 4; k++)
{
if (i == j || i == k || j == k) //重复跳过
continue;
x = i * 100 + j * 10 + k;
printf("%-5d\t", x);
}
printf("\n");
}
return 0;
}
输出结果: