I\'m trying to get the highest and lowest numbers entered by the user. The code below seems to be mostly working but I can\'t seem to get the right number for the lowest val
import java.io.*;
public class jem3
{
public static void main(String []args)
{
BufferedReader dataIn = new BufferedReader(new InputStreamReader( System.in ));
int high;
int lowest;
int num;
System.out.println("Enter number");
num=Integer.parseInt(dataIn.readLine());
lowest = highest = num;
for(int a=0;a<10;a++)
{
try
{
num=Integer.parseInt(dataIn.readLine());
}
catch(IOException e)
{
System.out.println("error");
}
if(num>high)
{
high=num;
}
if(num
i added code after reeading first line to set high and lowest, so if user will give you 10 numbers '9' it will output lowest number being '9' and not 1 as it would (similiar with high).