Write a program that gets temperature from the user in Fahrenheit and converts it into Celsius using the formula C=5/9*(F-32).

package input.output.programm;

import java.util.Scanner;

class InputOutputProgramm {

public static void main(String[] args) {

Scanner n=new Scanner(System.in);

float cel,fahr;

System.out.println(“Enter the temperature in Fahrenheit “);

fahr= n.nextFloat();

cel=5/9*(fahr-32);

System.out.println(“Temperature in Fahrenheit is =”+fahr);

}

}

Output

Enter temperature in Fahrenheit

56

Temperature is=56.0

 

Leave a Reply

Your email address will not be published. Required fields are marked *