Convert Fahrenheit to Celsius Program in Java


Prev Tutorial Next Tutorial

Java Program to Convert Fahrenheit to Celsius

Fahrenheit and Celsius are two unit for measure temperature. We have standard formula to Convert Fahrenheit to Celsius using this formula you can change temperature Fahrenheit to Celsius.

Formula

  c = (f - 32) * 5/9;

Convert Celsius to Fahrenheit in Java

import java.util.Scanner;
class Fahrenheit_to_Celsius 
{
 public static void main(String[] args)
{
  float cel, far;

Scanner s=new Scanner(System.in);
System.out.println("Enter temp. in Fahrenheit :");
far=s.nextInt();

 c = (f - 32) * 5/9;

System.out.println("Temp. in Celsius: "+cel);
}
}

Output

Enter temp. in Fahrenheit: 98
Temp. in Celsius: 36.666668

Syntax to compile and run java program

Syntax

for compile -> c:/>javac Fahrenheit_to_Celsius
for run -> c:/>java Fahrenheit_to_Celsius

Prev Tutorial Next Tutorial

Google Advertisements
Download Projects

Google Adsense Advertisements

Buy 3 Year Old Domain, Tutorialday.com, SeosmoTools.com @$200

Buy This Ad Space @$50 per Month, Ad Size 300X250 Contact on: hitesh.xc@gmail.com WhatsApp no. 8882538826

Yahoo Advertisements