Find Larger Number
Picking the bigger of two values is a classic decision-making step in coding. Whether you''re comparing high scores in a game or finding the larger of two prices, Find Larger Number focuses on this simple but essential logic.
The task is simple: you have two numbers, and you need to determine which one is the maximum. If the numbers are the same, either one can be considered the larger one since they are equal.
For example, if you are given 7 and 12, the answer is clearly 12. If you are given 9 and 9, the answer is just 9. Your algorithm should take any two integers and return the one that represents the higher value.
Example Input & Output
Both values are equal, so the result is 7.
12 is larger than 3.
9 is larger than 4.
Algorithm Flow

Solution Approach
Start by reading the two integers.
After that, compare the first number with the second number.
If the first number is greater than or equal to the second number, print the first number.
If that condition is false, print the second number instead.
This works because one of the two numbers must be the larger value, and if they are equal, either one is a correct result.
Best Answers
program find_larger_number
dictionary
a, b: integer
algorithm
input(a, b)
if a >= b then
output(a)
else
output(b)
endif
endprogramComments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this Challenge.
