Java Program to calculate Fahrenheit to Celsius

Sample Input 1:

Enter the Fahrenheit: 284

Sample Output 1:

The Celsius Is :140

Try your Solution

Strongly recommended to Solve it on your own, Don't directly go to the solution given below.

public class Hello { public static void main(String args[]) { //Write your code here } }

Program or Solution

				
			
					
import java.util.*;
class Converter
{
   public static void main(String args[])
   {
       double fahreheit,celsius;
       Scanner sc=new Scanner(System.in);
       System.out.println("Enter The Fahrenheit:");
       fahreheit=sc.nextDouble();
       celsius=(fahreheit-32)*0.5556;
       System.out.println("The Celsius Is:"+celsius);
   }
}
			
				
			

Program Explanation

Get Fahrenheit as input (using scanner class) Calculate Celsius using Formula celsius=(fahreheit-32)*0.5556 print Celcius (using system.out.println).

Comments