- #include <stdio.h>
- /*
- *用1、2、3、4这四个数字中的三个数组成一个三位数,要求每一位的数字互不相同
- */
- int main(int argc, const char *argv[])
- {
- int x,y,z;
- for (x = 1; x < 5; x++) {
- for (y = 1; y < 5; y++) {
- for (z = 1; z < 5; z++) {
- if(x!=y && x!=z &&y!=z){
- printf("%d%d%d\\n",x,y,z);
- }
- }
- }
- }
- return 0;
- }
- //该片段来自于http://www.codesnippet.cn/detail/1908201410247.html
来源: http://www.codesnippet.cn/detail/1908201410247.html