I dont understand. Are all the numbers entered as 9 8 7 6, etc. ? What's the grand idea of the question? What is it suppose to be demonstrating?
package com.codegym.task.task05.task0532;
import java.io.*;
import static java.lang.System.*;
/*
Task about algorithms
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
//write your code here
int maximum = 0;
while (true) {
int a = Integer.parseInt(reader.readLine());
if (a > maximum)
maximum = a;
if (a <= 0)
break;
}
if (maximum != 0){
System.out.println(maximum);
}
}
}