Loading...
Loading...
Loading...
You want to buy a calculator and three shops quote different prices. Read the three prices and print the lowest one, without using Math.min.
Example 1
Input
450 399 520
Output
399
The second shop is cheapest.
Example 2
Input
300 300 310
Output
300
Two shops tie for the lowest price; the price is still 300.
Try the problem first. Open one hint at a time.
Start by assuming the first price is the lowest.
Compare it with the second price and then with the third, replacing it whenever you find a smaller one.
Write your Java code, run it on the examples and submit it to hidden tests.
Solve in the editor