Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SmallestOfThree {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int a = readInteger(scanner);
- int b = readInteger(scanner);
- int c = readInteger(scanner);
- int minNumber = findMinNumber(a,b,c);
- System.out.println(minNumber);
- }
- public static int readInteger(Scanner scanner){
- int number = scanner.nextInt();
- return number;
- }
- public static int findMinNumber(int first, int second, int third){
- if (first < second && first < third){
- return first;
- }else if (second < first && second < third){
- return second;
- }else{
- return third;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement