Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.out.println("Введите 2 числа");
- 11
- int a = scnr.nextInt();
- 12
- int b = scnr.nextInt();
- 13
- if (a > b) {
- 14
- System.out.printf("Between %d and %d, maximum is %d %n", a, b, a);
- 15
- } else {
- 16
- System.out.printf("Between %d and %d, maximum number is %d %n", a, b, b);
- 17
- }
- 18
- int max = Math.max(a, b);
- 19
- System.out.printf("Maximum value of %d and %d using Math.max() is %d %n", a, b, max);
- 20
- int x = scnr.nextInt();
- 21
- int y = scnr.nextInt();
- 22
- 23
- if (x < y) {
- 24
- System.out.printf("Between %d and %d, Minimum Number is %d %n", x, y, x);
- 25
- } else {
- 26
- System.out.printf("Between %d and %d, Minimum is %d %n", x, y, y);
- 27
- }
- 28
- int min = Math.min(x, y);
- System.out.printf("Maximum value of %d and %d using Math.min() is %d %n", x, y, min)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement