由1-9,组合一个3位的数,要求各位,十位,百位的数都不相同,
将所有的可能的情况进行输出。
#include <stdio.h>
int main(int argc, const char *argv[])
{
int g,s,b;
g = 1;
while(g <= 9)
{
s = 1;
while(s <= 9)
{
b = 1;
while(b <= 9)
{
if (g != s && s != b && g != b)
{
printf("%d%d%d ", b, s, g);
// printf("%d ", b*100+s*10+g);
}
++b;
}
++s;
}
++g;
}
putchar('\n');
return 0;
}