Simple Java Program 6: Kilograms To Ounces Conversion

This programs asks the user to input the amount of kilogram and it will return its value in ounce.


import java.util.Scanner;
public class KgToOz {

    public static void main(String[] args) {
        double oz = 35.274;
        System.out.println("Enter Kilograms: ");
        double kg;
        Scanner reader = new Scanner(System.in);
        kg = reader.nextDouble();
        double kgtoounce=kg*oz;
        System.out.println( kg+ " kilograms is " +kgtoounce+ " in ounce");
       
    }

}


Here's the output:

Comments