TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

Program to convert Fahrenheit into Celsius

Program to convert Fahrenheit into Celsius on fibonacci, factorial, prime, armstrong, swap, reverse, search, sort, stack, queue, array, linkedlist, tree, graph etc.

<< Back to PROGRAM

Program to convert Fahrenheit into Celsius

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)


Solution

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

Next Topic#




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf