/*编程打印1,2,3.....n的全排列
1,2,3
1,3,2
2,1,3,
2,3,1
3,1,2
3,2,1*/
# include<stdio.h>
# include<math.h>
void main()
{
int n;
int a,b,c;
printf("input=:");
scanf("%d",&n);
for(a=1;a<=n;a++)
{
printf("\n");
for (b=1;b<=n;b++)
for(c=1;c<=n;c++)
if ((a!=b)&&(b!=c)&&(a!=c)) printf("%d,%d,%d\t",a,b,c);
}
}
可以了~~