Advertisement
Dido09

SmallestOf3

Feb 11th, 2020
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SmallestOfThree {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int a = readInteger(scanner);
  8. int b = readInteger(scanner);
  9. int c = readInteger(scanner);
  10.  
  11. int minNumber = findMinNumber(a,b,c);
  12. System.out.println(minNumber);
  13.  
  14. }
  15. public static int readInteger(Scanner scanner){
  16. int number = scanner.nextInt();
  17. return number;
  18. }
  19. public static int findMinNumber(int first, int second, int third){
  20. if (first < second && first < third){
  21. return first;
  22. }else if (second < first && second < third){
  23. return second;
  24. }else{
  25. return third;
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement