Size of three numbers in C language and three in C Language

Source: Internet
Author: User

Size of three numbers in C language and three in C Language

This question is simple and there are many methods. Here I want to solve the Sorting Problem by using a mathematical method. Ps: I am a scum, and the program is not well written. Thank you for your help.

Train of Thought:

Take 1 2 3 as an example to consider all possible input types (not listed here): 1 2 3; 3 2 1; 2 1 3; 1 1 1; 1 2 2; 1 2 1; the overall idea is to take two numbers from the input three numbers, select the largest of the two numbers and compare the maximum number with the third number. For more information, see the code;

Code:

Summary:

In fact, the essence of this Code is similar to that of the if statement. However, you do not need to call three if statements every time. Therefore, an if statement can output more efficient answers.

Related Article

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.