Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class SmallestElementInArray {
  5. public static void main(String[] args) {
  6. Scanner scanner = new Scanner(System.in);
  7. String[] stringArr = scanner.nextLine(). split( " ");
  8. int[] number = new int[stringArr.length];
  9. int minNumberSoFar = Integer.MAX_VALUE;
  10.  
  11. for (int i = 0; i < number.length; i++) {
  12. int currentNumber = number[i];
  13. if (currentNumber < minNumberSoFar){
  14. minNumberSoFar = currentNumber;
  15. }
  16. }
  17. System.out.println(minNumberSoFar);
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement