Answer the question
In order to leave comments, you need to log in
How to compare 3 numbers using if?
I can not find a solution to the problem because at the time of comparing the numbers, the compiler starts to behave inappropriately. So the problem is not in the compiler. After sitting and poking the buttons with a stick and a stone, I realized that everything works if the last number is 0. As soon as this equality changes, it shows the "minimum" - positive, and
"the maximum - negative.
In general, here is one of the examples that worked for me with zero, but with other integers everything goes to hell.
https://onlinegdb.com/Bya0vCZlv
Answer the question
In order to leave comments, you need to log in
if (a > b) {
larg = a;
small = b;
if (c > a) larg = c;
else if (b > c) small = c;
} else {
larg = b;
small = a;
if (c > b) larg = c;
else if (a > c) small = c;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question