Decode School

Decode School - The School for Problem Solvers
Need Assignment / Project Guidance (or) Training in Python?

Java Program to calculate Fahrenheit to Celsius

Sample Input 1:

Enter the Fahrenheit: 284

Sample Output 1:

The Celsius Is :140

Program or Solution

					    
							
import java.util.*;
class FaToCe
{
   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).