Convert Celsius to Fahrenheit Program in Java
Advertisements
Java Program to Convert Celsius to Fahrenheit
Fahrenheit and Celsius are two unit for measure temperature. We have standard formula to Convert Celsius to Fahrenheit using this formula you can change temperature Celsius to Fahrenheit.
Formula
f = c * 9/5 + 32;
Convert Celsius to Fahrenheit in Java
import java.util.Scanner; class Celsius_to_Fahrenheit { public static void main(String[] args) { float cel, far; Scanner s=new Scanner(System.in); System.out.println("Enter temp. in Celsius :"); cel=s.nextInt(); far = cel * 9/5 + 32; System.out.println("Temp. in Fahrenheit: "+far); } }
Output
Enter temp. in Celsius: 36 Temp. in Fahrenheit: 96.000
Syntax to compile and run java program
Syntax
for compile -> c:/>javac Celsius_to_Fahrenheit for run -> c:/>java Celsius_to_Fahrenheit
Google Advertisment