beyondgrader.com Logo
DemoBrowseAboutTeamLogin

Largest of Three

Geoffrey Challen // 2020.8.0

Let's use conditionals to perform a common task: finding the largest of, in this case, three numbers.

You can imagine using this kind of code in a lot of places. Maybe you're picking the next person for your pickup basketball team and have the heights of three possible teammates. Maybe you're choosing between three medications and want to choose the best based on the results of some study. Or maybe you're choosing a steak to cook for dinner and want the heaviest cut of meat at the same price. In all cases the logic is the same.

Assume you are working with three double variable: first, second, and third. Your code should print the value of the largest of the three. (If two or more values tie for the largest, you can print any of the largest values.)