Εύρεση του μέγιστου αριθμού
import gr.aueb.dds.BIO;
/*
* Read numbers until 0 is entered.
* Print the maximum number read.
* Demonstrates the use of a variable to hold the temporary maximum value
*/
class FindMax {
public static void main(String args[]) {
double val;
double maxVal = -1e308; // Very small number
while ((val = BIO.readDouble()) != 0)
if (val > maxVal)
maxVal = val;
BIO.println(maxVal);
}
}