123456789101112131415161718 |
- import static java.lang.Math.*; // macht Methoden von Math bekannt
- public class SortDouble
- {
- public static void main(String[] args) throws
- Exception
- {
- InteractiveIO.write("Dieses Programm sortiert drei Zahlen.");
- double a = InteractiveIO.promptForDouble("Bitte erste Zahl eingeben: ");
- double b = InteractiveIO.promptForDouble("Bitte zweite Zahl eingeben: ");
- double c = InteractiveIO.promptForDouble("Bitte dritte Zahl eingeben: ");
- double min = min(a, min(b, c));
- double max = max(a, max( b, c));
- double mid =a + b + c - min - max;
- InteractiveIO.write("Sortiert: " + min + " " + mid + " " + max);
- }
- }
|