Ledger Nano X - The secure hardware wallet
SHARE
TWEET

number_sequence

a guest Apr 5th, 2020 126 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Number_sequence {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int n = Integer.parseInt(scanner.nextLine());
  7.         int max = Integer.MIN_VALUE;
  8.         int min = Integer.MAX_VALUE;
  9.         for (int i = 0; i < n; i++) {
  10.             int number = Integer.parseInt(scanner.nextLine());
  11.             if (number > max) {
  12.                 max = number;
  13.             }
  14.             if (number < min) {
  15.                 min = number;
  16.             }
  17.         }
  18.         System.out.printf("Max number: %d%n", max);
  19.         System.out.printf("Min number: %d", min);
  20.     }
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top