Hi,
can anyone tell me why the third condition fails. I think i have done everything that they wanted and furthermore I only added code and haven't changed any thing, that was given by/from the system.
Best regards
Steffen
P.S.: Can anyone tell me if it's given from or given by.
package de.codegym.task.task07.task0721;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Tiefst- und Höchstwerte in Arrays
*/
class Debug{
public static boolean debug = false;
}
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int[] blocks = new int[20];
int hoechstwert;
int tiefstwert;
//schreib hier deinen Code
hoechstwert = 0;
tiefstwert = 99999;
for(int i = 0; i < 20; i++){
String tmp = reader.readLine();
if(tmp != null){
blocks[i] = Integer.parseInt(tmp);
if(Debug.debug){
System.out.println("at position " + i +" read: " + blocks[i]);
}
if(blocks[i] > hoechstwert){
hoechstwert = blocks[i];
if(Debug.debug){
System.out.println("new hoestwert: " + hoechstwert);
}
}
if(blocks[i] < tiefstwert){
tiefstwert = blocks[i];
if(Debug.debug){
System.out.println("new tiefstwert: " + tiefstwert);
}
}
}
}
System.out.print(hoechstwert + " " + tiefstwert);
}
}