|
|
|
Change Fahrenheit To Centigrade
|
Article:
|
Viewed:
1861
Posted On:
24/07/2013 03:40:11
Hi all,With the help of this article i am going to tell you that how we can change the temprature from fahrenheit to centigrade ........in java
|
|
|
Below is my code:
import java.util.Scanner; class temprature { public static void main(String s[]) { int a,b; System.out.println("enter temprature in Fahrenheit "); Scanner scan=new Scanner(System.in); a=scan.nextInt(); System.out.println("you entered temprature ="+a); b=(9*a)/5+32; System.out.println("temprature in centigrate ="+b); } }
Step 1: After writing this in notepad save the file with the name followed by (.java) for eg.I saved it with temprature.java Step 2 : Open command prompt
Step 3 : Write javac temprature.java - Press Enter for compilation
Step 4 : Write java temprature for execution
Output:

|
|
|
|
|
|