Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created a file containing Basic Java Programs. #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Basic Java Programs
Original file line number Diff line number Diff line change
@@ -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);
}
}

##..........................................##