Title: There are 1,2,3,4 numbers, can make up how many different and no repetition of the number of three digits? How much are they?
Solution: Program Analysis: Can be filled in hundreds, 10 digits, single digit numbers are 1,2,3,4 . Make all the permutations and then remove the permutations that do not meet the criteria.
Program:
#include <stdio.h>
int main ()
{
int i = 0, j = 0, k = 0,count=0;
for (i = 1; i < 5; i++)
{
for (j = 1; j < 5; J + +)
{
for (k = 1; k < 5; k++)
{
if ((i! = j) && (i! = k) && (J! = k))
{
count++;
printf ("%d%d%d\n", I, J, K);
}
}
}
}
printf ("count=%d\n", count);
System ("pause");
return 0;
}
Operation Result:
123
124
132
134
142
143
213
214
231
234
241
243
312
314
321
324
341
342
412
413
421
423
431
432
Count=24
Please press any key to continue ...
This article is from the "Rock Owl" blog, please be sure to keep this source http://yaoyaolx.blog.51cto.com/10732111/1765792
There are 1, 2, 3, 4 digits, how many different and no repetition of the number of three digits? How much are they?