Untitled

mail@pastecode.io avatar
unknown
java
7 months ago
704 B
0
Indexable
Never
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int i, j = -1; // Initialize j with a default value
        int[] m = new int[100];
        int[] n = new int[100];

        n[0] = 0;
        m[0] = 0;

        for (i = 0; true; i++) {
            n[i] = scanner.nextInt();
            if (n[i] < 0)
                break;

            for (j = 0; j < i; j++) {
                if (n[i] < 100)
                    m[j] = n[i];

                if (n[i + 1] >= m[j])
                    m[j + 1] = n[i + 1];
            }
        }

        System.out.println(m[j]);
    }
}