Sunday, 5 November 2017

java problems with solution



Write . Write a program that converts pounds into kilograms.
The program prompts the user to enter a number in pounds, converts it
to kilograms, and displays the result
Description:
One pound is 0.454 kilograms
Solution
import java.util.*;
public class Message {
 public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
   float pound;
   System.out.println("Enter the mass in pound");
   pound=in.nextFloat();
   System.out.println("The mass in kilogram ="+(pound*.454));
 
 }
}
Output:

No comments:

Post a Comment