From 526ae475f3f161fccb499e8cf63bc295e858e1de Mon Sep 17 00:00:00 2001 From: Himanshu Rathod Date: Mon, 14 Oct 2019 14:54:22 +0530 Subject: [PATCH] Created a file containing Basic Java Programs. --- Basic Java Programs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Basic Java Programs diff --git a/Basic Java Programs b/Basic Java Programs new file mode 100644 index 0000000..1dc0cfc --- /dev/null +++ b/Basic Java Programs @@ -0,0 +1,18 @@ +Q. Convert feet into meters. + +Write a program that reads a number in feet, converts it to meters, and displays the result. +One foor is 0.305 meter. Note: Use datatype as Double. + +Solution: +import java.io.*; +import java.util.*; +public class convert { + public static void main(String[] args) { + Scanner s=new Scanner(System.in); + Double feet=s.nextDouble(); + Double m=feet*0.305; + System.out.printf("%0.3f meters",m); + } +} + +##..........................................##