please.watch in comment of code 3 try, last one in very end. (in real them was much more.). all worked but why . maybe i dont understand the task but i tryed everything i could though about.
package com.codegym.task.task05.task0532;
import java.io.*;
/*
Task about algorithms
*/
public class Solution {
public static void main(String[] args) throws Exception {
/*
int x = 0, N;
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
N = Integer.parseInt(reader.readLine());
if (N > 0) {
int cc = N;
x = N;
for (int i = 1 ; i != (cc); i++)
{
N = Integer.parseInt(reader.readLine());
if ( N > 0)
{
if ( N > x ) x = N;
}
else return;
} // for 1 loop
System.out.println( x );
} // if
else return;
// ------------------
}
}
//-------- after 1- st try.
*/
// start 2 try -------------------------
/*
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(reader.readLine());
int x = N;
int cc = N;
int i = 1;
int x1 = N;
System.out.println(" x1 -" + x1);
while (cc != i )
{
System.out.println(N);
N = Integer.parseInt(reader.readLine());
if ( N > 0)
{
if ( N > x ) x = N;
}
else return;
System.out.println(" N in if - " + N + ". i - " + i);
i++;
} // while loop
N = x;
System.out.println(N);
}
}
*/ //------- end 2 try----------
//-- start 3 try ----------------------------------------
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(reader.readLine());
if ( N <= 0) return;
int i = 0;
int cc = N;
int x = N;
int z = 1;
for (; i != cc; i++)
{
// System.out.println(i + " (i != x) " + cc);
// System.out.println(" z is - " + z );
// System.out.println(" N == " + N);
// z = z + 1;
N = Integer.parseInt(reader.readLine());
if ( N > 0)
{
// System.out.println(" if " + N + " N > x " + x + " x = N ");
if ( N > x ) x = N;
// System.out.println(" after " + N + " N > x " + x);
}
else return;
// System.out.println(" N in if - " + N + ". i - " + i);
} // while loop
N = x;
System.out.println(N);
}
}