Get the App
SLTechnology News&Howtos  ›  Development  › 

How to compare three numbers in C language

Shulou Source: shulou.com Published: 2022-06-01 01:51:01 10月04日 Update

This article mainly introduces the relevant knowledge of how the C language compares the three numbers, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this C language how to compare the three numbers. Let's take a look.

Compare three numbers

In the following example, two integer variables are defined and three values are compared using if. You can first look at the logic diagram:

Example

# include

Int main () {

Int a, b, c; a = 11; b = 22; c = 33

If (a > b & & a > c)

Printf ("% d maximum", a)

Else if (b > a & & b > c)

Printf ("% d maximum", b)

Else if (c > a & & c > b)

Printf ("d maximum", c)

Else

Printf ("there are two or three values equal")

Return 0

}

Output result:

33 this is the end of the article on "how to compare three numbers in C language". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to compare the three numbers in C language". If you want to learn more, you are welcome to follow the industry information channel.

Tags: Number language maximum knowledge three two content examples numerical values articles values variables easy to operate integers articles easy to understand more see results industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Docker OPPO Reno Shulou Information Xiaomi