Solution Review: Compute & Return Maximum

This lesson will explain how to compute and return the maximum of two numbers.

Solution 1: Use the if Statement

Use the if statement to compare if variable x is greater than y x>y. If x is greater than y, then save the value of x in maximum; otherwise, save the value of y.

Get hands-on with 1000+ tech skills courses.