Advertisement
Guest User

Untitled

a guest
Apr 10th, 2020
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.84 KB | None | 0 0
  1. System.out.println("Введите 2 числа");
  2. 11
  3.   int a = scnr.nextInt();
  4. 12
  5.   int b = scnr.nextInt();
  6. 13
  7.   if (a > b) {
  8. 14
  9.     System.out.printf("Between %d and %d, maximum is %d %n", a, b, a);
  10. 15
  11.   } else {
  12. 16
  13.     System.out.printf("Between %d and %d, maximum number is %d %n", a, b, b);
  14. 17
  15.   }
  16. 18
  17.   int max = Math.max(a, b);
  18. 19
  19.   System.out.printf("Maximum value of %d and %d using Math.max() is %d %n", a, b, max);
  20. 20
  21.   int x = scnr.nextInt();
  22. 21
  23.   int y = scnr.nextInt();
  24. 22
  25.  
  26. 23
  27.   if (x < y) {
  28. 24
  29.     System.out.printf("Between %d and %d, Minimum Number is %d %n", x, y, x);
  30. 25
  31.   } else {
  32. 26
  33.     System.out.printf("Between %d and %d, Minimum is %d %n", x, y, y);
  34. 27
  35.   }
  36. 28
  37.    
  38.  
  39.   int min = Math.min(x, y);
  40.  
  41.  
  42.  
  43.   System.out.printf("Maximum value of %d and %d using Math.min() is %d %n", x, y, min)
  44.  
  45.  }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement