Untitled

mail@pastecode.io avatar
unknown
java
a year ago
662 B
3
Indexable
Never
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int i, j;
        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]);
    }
}