#include<stdio.h>
void main()
{
int i=0,j,k,n,m[3],M[6],count=0;
scanf("%d",&n);
while(n)
{
m[i++]=n%10;
n/=100;
}
for(i=0;i<3;i++)
for(j=0;j<3;j++)
for(k=0;k<3;k++)
if(m[i] && i!=j && i!=k && j!=k)
M[count++]=100*m[i]+10*m[j]+m[k];
for(i=0;i<count;i++)
printf("%d\n",M[i]);
}
运行结果:
\Debug>Test.exe