Shamil189

Наибольшее из трех чисел

Apr 5th, 2020
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. public class largestOf3Numbers {
  2.     public static void main(String[] args) {
  3.         Scanner scan = new Scanner(System.in);
  4.         System.out.println("Введите три числа: ");
  5.         int a = scan.nextInt();
  6.         int b = scan.nextInt();
  7.         int c = scan.nextInt();
  8.  
  9.         if (a > b && a > c){
  10.             System.out.println("Максимальное число: " + a);
  11.         }
  12.         else if (b > a && b > c){
  13.             System.out.println("Максимальное число: " + b);
  14.         }
  15.         else {
  16.             System.out.println("Максимальное число: " + c);
  17.         }
  18.  
  19.  
  20.     }
  21. }
Add Comment
Please, Sign In to add comment