Task. Were given two real numbers [latex]x[/latex] and [latex]y[/latex]. Find [latex]\max (x, y)[/latex].
Tests
Input | Output |
---|---|
758 843 | Maximum number is: 843 |
459 238 | Maximum number is: 459 |
Solution
1 2 3 4 5 6 7 8 9 10 11 |
import java.util.Scanner; class Main { public static void main (String[] args) throws java.lang.Exception { Scanner s = new Scanner(System.in); int x = s.nextInt(); int y = s.nextInt(); System.out.println("Maximum number is: " + (x > y? x : y)); s.close(); } } |