Advertisement
Guest User

Untitled

a guest
Jun 14th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. Scanner myin = new Scanner(System.in);
  2. System.out.println("1. ");
  3. int a = myin.nextInt();
  4. System.out.println("2. ");
  5. int b = myin.nextInt();
  6. System.out.println("3. ");
  7. int c = myin.nextInt();
  8. System.out.println("4. ");
  9. int d = myin.nextInt();
  10. System.out.println("5. ");
  11. int e = myin.nextInt();
  12. System.out.println("6. ");
  13. int f = myin.nextInt();
  14. System.out.println("7. ");
  15. int g = myin.nextInt();
  16. System.out.println("8. ");
  17. int h = myin.nextInt();
  18. System.out.println("9. ");
  19. int j = myin.nextInt();
  20. System.out.println("10. ");
  21. int k = myin.nextInt();
  22.  
  23.  
  24. int[] myArray = {a,b,c,d,e,f,g,h,j,k};
  25. int length = myArray.length;
  26. int x = myArray[0];
  27. for (int i = 0; i < length; i++) {
  28. if (myArray[i] < x) {
  29. x = myArray[i];
  30. }
  31. }
  32. System.out.println(x);
  33.  
  34. for (int i = 0; i < length; i++) {
  35. if (myArray[i] > x) {
  36. x = myArray[i];
  37. }
  38. }
  39. System.out.println(x);
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement