# Question 17: How many three numbers can be composed of 1, 2, 3, and 4 distinct numbers without repeated numbers? What is it?

Source: Internet
Author: User

/*************************************** ************************
* *** Auther: liuyongahui
* ***** Date:
* ** Language: C
**************************************** ***********************/
/*
Question 17: How many three numbers can be composed of 1, 2, 3, and 4 distinct numbers without repeated numbers? What is it?

*/

# Include <stdio. h>

Int main ()
{
Int I;
Int j;
Int k;
Int l = 0; // used to calculate the number
Int a [1000]; // declare a larger space to avoid overflow

For (I = 1; I <5; I ++)
{
For (j = 1; j <5; j ++)
{
If (I! = J)
{
For (k = 1; k <5; k ++) // In I! = Execution under j Conditions
{
If (k! = J & k! = I) // In l! = J & l! = K
{
A [l ++] = I * 100 + j * 10 + k; // use an array to save the three numbers that meet the conditions.
}
}
}
}
}

Printf ("there are % d three numbers that are different from each other and have no repeated numbers, as follows: \ n", l );
For (I = 0; I <l; I ++)
{
Printf ("% d \ n", a [I]);

}

Return 0;

}

Related Keywords:
Related Article

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.