Files
java-schule/2/Eingabe/Kraftstoffverbrauch.~ava
Mykola Fesenko 899a05907b backup
2025-07-29 08:08:23 +02:00

16 lines
492 B
Plaintext

import java.util.Scanner;
public class Kraftstoffverbrauch {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
double gefahreneKm = 55.0;
double kraftstoffmenge = 5.0;
System.out.print("KM: ");
if(input.hasNextDouble()) {
gefahreneKm = input.nextDouble();
}
if(input.hasNextDouble()) {
gefahreneKm = input.nextDouble();
}
System.out.println("Kraftstoffverbrauch: " + ((kraftstoffmenge/gefahreneKm)*100));
}
}