Advertisement
marinjordanov

Untitled

Sep 13th, 2021
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. public class Converter {
  2. public static void main(String[] args) {
  3. Scanner scanner = new Scanner(System.in);
  4. double milesPerGallon = Double.parseDouble(scanner.nextLine());
  5. if (milesPerGallon>0&&milesPerGallon<=100){
  6. double kilometerForlitter = milesPerGallon*(1.6/4.54);
  7. double consumptionLittersForHundret= 100/kilometerForlitter;
  8. System.out.print(""+Math.floor(consumptionLittersForHundret)+" litters per 100 km");
  9.  
  10.  
  11. }
  12.  
  13. }
  14. }
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement