Q:

Program to convert Fahrenheit into Celsius

belongs to collection: Basic Programs

0

Explanation

Fahrenheit and Celsius are the measures of temperature having Unit in degrees as oF

oC respectively. In this tutorial, we have to convert Fahrenheit to Celsius by using the scientific formula in programmes of different languages.

Formula

T(oC)   =  ((T(oF)  -  32  ) ×  5)/9

Algorithm

  1. Define temperature in Fahrenheit unit.
  2. Apply in the formula.
  3. Print the temperature in Celsius.

Complexity

O(1)

Temperature in Celsius = ((Fahrenheit-32)*5)/9

Input:

Fahrenheit = 54  

Output:

Temperature in Celsius= ((54-32)*5)/9 = 12.22222

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Python

Fahrenheit= 54  
Celsius = ((Fahrenheit-32)*5)/9  
print("Temperature in Celsius is: ");  
print(Celsius);  

 

Output:

Temperature in Celsius is: 12.22222

 

C

#include<stdio.h>  
                   int main()   
                   { float Fahrenheit, Celsius;  
                   Fahrenheit = 64;  
                   Celsius = ((Fahrenheit-32)*5)/9;  
                   printf("\n\n Temperature in Celsius is : %f",Celsius);  
                       return (0);  
    } 

 

Output:

Temperature in Celsius is: 17.7777777778

 

JAVA

public class Celsius  
 {  
   public static void main (String args[])  
    { float Fahrenheit, Celsius;  
          Fahrenheit = 43;  
          Celsius  = ((Fahrenheit-32)*5)/9;  
          System.out.println("Temperature in celsius is: "+Celsius);  
    }}  

 

Output:

Temperature in celsius is: 6.1111111 

 

C#

using System;  
class main  
{   static void Main()   
    {  
float Fahrenheit, Celsius;  
Fahrenheit = 35;  
Celsius =((Fahrenheit - 32)*5)/9;  
Console.WriteLine("Temperature in celsius is: "+Celsius);  
    }}  

 

Output:

Temperature in celsius is: 1.66666667

 

PHP

<?php  
       $fahrenheit = 46 ;  
       $celsius = (($fahrenheit-32)*5)/9 ;   
       echo("Temperature in celsius is: ");  
       echo($celsius);  
?> 

 

Output:

Temperature in celsius is: 7.7777778

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Program to find the area of an equilateral triangl... >>
<< Program to convert days into years...