Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scanner myin = new Scanner(System.in);
- System.out.println("1. ");
- int a = myin.nextInt();
- System.out.println("2. ");
- int b = myin.nextInt();
- System.out.println("3. ");
- int c = myin.nextInt();
- System.out.println("4. ");
- int d = myin.nextInt();
- System.out.println("5. ");
- int e = myin.nextInt();
- System.out.println("6. ");
- int f = myin.nextInt();
- System.out.println("7. ");
- int g = myin.nextInt();
- System.out.println("8. ");
- int h = myin.nextInt();
- System.out.println("9. ");
- int j = myin.nextInt();
- System.out.println("10. ");
- int k = myin.nextInt();
- int[] myArray = {a,b,c,d,e,f,g,h,j,k};
- int length = myArray.length;
- int x = myArray[0];
- for (int i = 0; i < length; i++) {
- if (myArray[i] < x) {
- x = myArray[i];
- }
- }
- System.out.println(x);
- for (int i = 0; i < length; i++) {
- if (myArray[i] > x) {
- x = myArray[i];
- }
- }
- System.out.println(x);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement