Fahrenheit to Celsius

Fahrenheit to Celsius

Given a temperature F in Fahrenheit, your task is to convert it into Celsius using the following equation:-

T(°c) = (T(°f) – 32)*5/9


User Task: You have to take an input F and then convert Fahrenheit To Celsius.


-10^3 <= F <= 10^3

Note:- It is guaranteed that F – 32 will be a multiple of 9.


Return an integer containing converted temperature to Celsius.

Solution of Fahrenheit to Celsius in java :–

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
	public static void main (String[] args) throws java.lang.Exception
		//your code here
      Scanner sc = new Scanner(System.in);
      int F = sc.nextInt();
      int c = (F-32)*5/9;


Add a Comment

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