Open In App

C++ Program To Convert Fahrenheit To Celsius

Last Updated : 21 Dec, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

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

Input: 32
Output: 0

Input: -40
Output: -40

Formula for converting Fahrenheit scale to Celsius scale 

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

C++




// C++ program to convert Fahrenheit
// scale to Celsius scale
#include <bits/stdc++.h>
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;
}


Output: 

4.44444

Time Complexity: O(1)

Auxiliary Space: O(1)

Please refer complete article on Program For Fahrenheit to Celsius Conversion for more details!


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads