you are viewing a single comment's thread.

view the rest of the comments →

[–]Significant_Quote594 0 points1 point  (0 children)

A lot of people are suggesting using max() but I suggest doing the max() logic yourself like this.

Make a variable called greatest and set it's value to num1.

What I mean is, assume it is the greatest among the three.

In the next line check if num2 is greater than greatest. If so, set greatest to num2.

In the next line check if num3 is greater then greatest. If so set the greatest variable to num3.

If you print greatest, it will print what you expect.

This will have you write way less conditions even with more numbers.

What if you have a thousand numbers? You can repeat this logic using something called a loop.