Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SmallestElementInArray {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String[] stringArr = scanner.nextLine(). split( " ");
- int[] number = new int[stringArr.length];
- int minNumberSoFar = Integer.MAX_VALUE;
- for (int i = 0; i < number.length; i++) {
- int currentNumber = number[i];
- if (currentNumber < minNumberSoFar){
- minNumberSoFar = currentNumber;
- }
- }
- System.out.println(minNumberSoFar);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement