RGAlex

O1. Smallest Of Tree Number

Feb 5th, 2021
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. package ExerciseMethoods;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class O1SmallestOfTreeNumbers {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         int a = Integer.parseInt(scanner.nextLine());
  9.         int b = Integer.parseInt(scanner.nextLine());
  10.         int c = Integer.parseInt(scanner.nextLine());
  11.         System.out.println(smallestNumber(a, b, c));
  12.     }
  13.  
  14.     private static int smallestNumber(int a, int b, int c) {
  15.  
  16.         if (a <= b && a <= c) {
  17.             return (a);
  18.         } else if (b <= a && b <= c) {
  19.             return (b);
  20.         } else {
  21.             return (c);
  22.         }
  23.  
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment