Q-16- Write a java program that reads a number in feet, converts it to meters, and displays the result. One foot is 0.305 meter.
INPUT :
import java.util.Scanner;
public class NCM {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
double feet;
System.out.println("Enter A Value For Feet :");
feet=sc.nextDouble();
double meter=feet*0.305;
System.out.println(feet+" Feet Is "+meter+" Meters");
}
}
OUTPUT :
Enter A Value For Feet :
16.5
16.5 Feet Is 5.0325 Meters
INPUT :
import java.util.Scanner;
public class NCM {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
double feet;
System.out.println("Enter A Value For Feet :");
feet=sc.nextDouble();
double meter=feet*0.305;
System.out.println(feet+" Feet Is "+meter+" Meters");
}
}
Enter A Value For Feet :
16.5
16.5 Feet Is 5.0325 Meters
No comments:
Post a Comment