Tuesday, 20 December 2016

Java Program For Converting Temperature Celsius Into Fahrenheit

Problem :- Java Program For Converting Temperature Celsius Into Fahrenheit .means you have to given temperature in Celsius you need to change temperature in Fahrenheit .

Logic :- For converting temperature Celsius to Fahrenheit their is a formula you just put Celsius temperature and calculate and print temperature in Fahrenheit Formula is given below

Formula :-  

           Fahrenheit = 32 + (Celsius * 9 / 5)  //or you can use 1.8 in place of 9/5

See Also :- C++ Program For Converting Temperature Celsius Into Fahrenheit


Solution :-


/*
Visit http://www.programmingwithbasics.com/
*/
import java.util.*;
class CtoF
{
public static void main(String[] args)
{
float cel,feh;
Scanner scan = new Scanner(System.in);
System.out.println("Enter The Temperature in Celsius");
cel = scan.nextFloat();
feh = 32 + (cel * 9 / 5);
System.out.println("Temperature in Fahrenheit = " + feh);
}
}

See Also :- C Program For Converting Temperature Celsius Into Fahrenheit

Output :- 



Java Program For Converting Temperature Celsius Into Fahrenheit

No comments:
Write comments

Recommended Posts × +