Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Converter {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double milesPerGallon = Double.parseDouble(scanner.nextLine());
- if (milesPerGallon>0&&milesPerGallon<=100){
- double kilometerForlitter = milesPerGallon*(1.6/4.54);
- double consumptionLittersForHundret= 100/kilometerForlitter;
- System.out.print(""+Math.floor(consumptionLittersForHundret)+" litters per 100 km");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement