Greatest of Two Numbers
Practice this coding question on Coding Gurukul.
Problem statement
Two weather stations submit elevation readings for a field survey. The survey report needs the greater reading, including when both sites lie below sea level. Your task Compare the two integers a and b and print their maximum value. Important details Return a value rather than the name or position of a station. If the readings tie, print that common value once. Negative readings are ordered normally: for example, -2 is greater than -9. Do not replace a negative answer with zero. No sorting or special tie message is required; both inputs must participate in the comparison. Worked example For readings -12 and -5, the greater value is -5 because it is closer to zero. Equal readings of 4 and 4 produce 4.
Input format
One line contains a and b.
Output format
Print the greater integer.
Constraints
-1000000000 <= a, b <= 2000000000.
Sample input
-12 -5
Sample output
-5
Sign in to run or submit a solution in C++, Java or Python.