converting gallons to liters java program code example
Example: converting gallons to liters java program
package com.company;
public class Main {
public static void main(String[] args) {
double gallons; //holds gallons
double liters; //holds liters
gallons = 10; //gallons
liters = gallons *3.7854; // conversion to liters
System.out.println(gallons + " gallons is " + liters + " liters.");
}
}