C++ Program To Convert Fahrenheit To Celsius
Last Updated :
21 Dec, 2022
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++
#include <bits/stdc++.h>
using namespace std;
float Conversion( float n)
{
return (n - 32.0) * 5.0 / 9.0;
}
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!
Share your thoughts in the comments
Please Login to comment...