Write a program that inputs pounds from the user and converts it into kilograms.

public static void main(String[] args) {
Scanner n=new Scanner(System.in);
float pounds, kg;
System.out.println(“Enter weight in pounds=”);
pounds= n.nextFloat();

kg=(float) (pounds*0.454);

System.out.println(“kilograms=”+kg);

}

}

Output

run:
Enter weight in pounds=
5
kilograms=2.27
BUILD SUCCESSFUL (total time: 4 seconds)

4 Comments on “Write a program that inputs pounds from the user and converts it into kilograms.”

Leave a Reply

Your email address will not be published. Required fields are marked *