Computer Science, asked by Enkhzul, 6 hours ago

Write a program that will take as input a temperature in degrees Fahrenheit and will convert and output the temperature in degrees Celsius. (Hint: DegreesC = (DegreesF – 32) * 5/9)

Answers

Answered by RedProgrammer
0

Answer:

import java.util.Scanner;

public class Main {

   public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);

       System.out.print("Enter temperature in Fahrenheit : ");

       double fahrenheit = sc.nextDouble();

       double celsius = ((fahrenheit-32) * 5/9);  

       System.out.println(celsius + "C");

   }

}

Explanation:

  1. Accepting the Fahrenheit temperature from the user.
  2. Using the formula : DegreesC = (DegreesF – 32) * 5/9) and storing it in a variable 'celsius' typed double.
  3. Printing the result in the console.
Similar questions