# Program for Fahrenheit to Celsius conversion

Given a Temperature n in Fahrenheit scale convert it into Celsius scale .

Examples:

```Input : 32
Output : 0

Input :- 40
Output : -40
```

## Recommended: Please try your approach on {IDE} first, before moving on to the solution.

Formula for converting Fahrenheit scale to Celsius scale

`T(°C) = (T(°F) - 32) × 5/9`

## C++

 `// CPP program to convert Fahrenheit ` `// scale  to Celsius scale ` `#include ` `using` `namespace` `std; ` ` `  `// function to convert  ` `// Fahrenheit to Celsius ` `float` `Conversion(``float` `n) ` `{ ` `    ``return` `(n - 32.0) * 5.0 / 9.0; ` `} ` ` `  `// driver code ` `int` `main() ` `{ ` `    ``float` `n = 40; ` `    ``cout << Conversion(n); ` `    ``return` `0; ` `} `

## Java

 `// Java program to convert Fahrenheit ` `// scale to Celsius scale ` `class` `GFG { ` `     `  `// function to convert ` `// Fahrenheit to Celsius ` `static` `float` `Conversion(``float` `n) ` `{  ` `    ``return` `(n - ``32``.0f) * ``5``.0f / ``9``.0f; ` `} ` ` `  `// Driver code ` `public` `static` `void` `main(String[] args) { ` `    ``float` `n = ``40``; ` `    ``System.out.println(Conversion(n)); ` `} ` `} ` ` `  `// This code is contributed by Anant Agarwal. `

## Python3

 `# Python3 program to convert Fahrenheit ` `# scale to Celsius scale ` ` `  `# function to convert  ` `# Fahrenheit to Celsius ` `def` `Conversion(n): ` `    ``return``(n ``-` `32.0``) ``*` `5.0` `/` `9.0` ` `  `# driver code ` `n ``=` `40` `x ``=` `Conversion(n) ` `print` `(x) ` ` `  `# This article is contributed by Himanshu Ranjan `

## C#

 `// c# program to convert Fahrenheit ` `// scale to Celsius scale ` `using` `System; ` ` `  `class` `GFG { ` `     `  `// function to convert ` `// Fahrenheit to Celsius ` `static` `float` `Conversion(``float` `n) ` `{  ` `    ``return` `(n - 32.0f) * 5.0f / 9.0f; ` `} ` ` `  `// Driver code ` `public` `static` `void` `Main() ` `{ ` `    ``float` `n = 40; ` `    ``Console.Write(Conversion(n)); ` `} ` `} ` ` `  `// This code is contributed by Nitin Mittal. `

## PHP

 ` `

Output:

```4.44444
```

This article is contributed by Dibyendu Roy Chaudhuri. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

My Personal Notes arrow_drop_up

Improved By : nitin mittal

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.
{"ft_lang_label":"__label__en","ft_lang_prob":0.51514685,"math_prob":0.60914344,"size":3121,"snap":"2019-51-2020-05","text_gpt3_token_len":862,"char_repetition_ratio":0.17901829,"word_repetition_ratio":0.17422867,"special_character_ratio":0.28356296,"punctuation_ratio":0.10701107,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9950212,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-12-13T21:22:05Z\",\"WARC-Record-ID\":\"<urn:uuid:b8c92e23-d653-4c13-9260-8ef4a5ef4254>\",\"Content-Length\":\"142243\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:51bd6eb3-e4d8-42e4-b90c-a0bdcbb33612>\",\"WARC-Concurrent-To\":\"<urn:uuid:78b41bf8-acd4-40b2-9af6-81dc86b371b0>\",\"WARC-IP-Address\":\"23.56.173.26\",\"WARC-Target-URI\":\"https://www.geeksforgeeks.org/fahrenheit-celsius-conversion/\",\"WARC-Payload-Digest\":\"sha1:HWWQNOY6QT2Y4UXH57BAUIP6LTLENFZI\",\"WARC-Block-Digest\":\"sha1:3DOR2DJV4MDCHR5CPOU4KAZWBHTUSNI7\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-51/CC-MAIN-2019-51_segments_1575540569146.17_warc_CC-MAIN-20191213202639-20191213230639-00222.warc.gz\"}"}