void main()
{
int n[5];
int t[5];
for( int i = 0; i < 5; i++ )
{
printf("請輸入第%d個數字:",i);
scanf("%d",n[i]); //如果要求每次輸入的數都不相同,請進行判斷,這個都會的。
}
for( t[0] = 0; t[0]<5; t[0]++ )
{
for( t[1] = 0; t[1]<5; t[1]++ )
{
if( t[1] == t[0] )continue;
for( t[2] = 0; t[2]<5; t[2]++ )
{
if( t[2] == t[1] || t[2] == t[0])continue;
for( t[3] = 0; t[3]<5; t[3]++ )
{
if( t[3] == t[2] || t[3] == t[1] || t[3] == t[0] )continue;
for( t[4] = 0; t[4]<5; t[4]++ )
{
if( t[4] == t[3] || t[4] == t[2] || t[4] == t[1] || t[4] == t[0] )continue;
printf("%d%d%d%d ",n[t[0]],n[t[1]],n[t[2]],n[t[3]],n[t[4]])
}
}
}
}
}
}