Greatest of Three Numbers
Practice this coding question on Coding Gurukul.
Problem statement
Three sensors report the height of a moving platform at different moments. The inspection console must retain the highest of these three measurements. Your task Given three integers a, b, and c, output the greatest value among them. Important details Any position may contain the maximum, and two or all three readings may tie. Print the maximum only once. Measurements can be negative because the reference level is arbitrary; initialize comparisons from an actual reading rather than assuming zero is a lower bound. The problem asks for the value, not the index of the sensor or the number of tied readings. Worked example For readings 7, 12, and 9, the highest measurement is 12. For -8, -3, and -10, it is -3.
Input format
One line contains a b c.
Output format
Print the greatest integer.
Constraints
-1000000000 <= a, b, c <= 1000000000.
Sample input
7 12 9
Sample output
12
Sign in to run or submit a solution in C++, Java or Python.