There are 1, 2, 3, 4 digits, how many different and no repetition of the number of three digits? How much are they?

Source: Internet
Author: User

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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.