C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Program to convert Fahrenheit into CelsiusExplanationFahrenheit 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. FormulaT(oC) = ((T(oF) - 32 ) × 5)/9 Algorithm
ComplexityO(1) SolutionPythonFahrenheit= 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 JAVApublic 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
Next Topic#
|