Java Program || Write a Java program to enter temperature in Celsius and convert it into Fahrenheit.
JAVA Program
Write a Java program to enter temperature in Celsius and convert it into Fahrenheit.
(Hint)
fahrenheit = (celsius * 9 / 5) + 32.
Static :-
class fahreheit
{
public static void main(String args[])
{
double celsius = 100 ,fahreheit;
fahreheit = (celsius * 9 / 5) + 32;
System.out.println("The fahreheit is :- "+fahreheit);
}
}
Output :-
Dynamic :-
import java.util.*;
class fahreheit
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.println("Enter the temperature in celsius");
Double cel = in.nextDouble();
double fah = (cel * 9/5)+32;
System.out.println("The Temperature in Fahreheit is :- "+fah);
}
}
Output :-