Good evening im seeking help with this program, it is in a loop that ends if a negative number is entered, I am trying to get the largest number entered in the do while loop, ive tried creating a temporal variable (temp), but I dont know where to go from there, Help please, And to make it more FUN I cant use ARRAYS!!... but still pleeeeeeeese HELP!
do{
System.out.println(" Enter a number ");
ingreso = leer.nextInt();
i++;
//EFFORTS TO TRY TO GET THE LARGEST NUM:
sum = sum + ingreso;
temp = ingreso;
if(may > temp){
System.out.println("The largest number is: " + may);
}
}
while(ingreso >= 0);
average = sum/i;
System.out.println("Numbers entered " + i);
System.out.println("Average: " + average);
}