C++ program to convert fahrenheit to celsius

Views: 18   

Following program shows you how to convert fahrenheit to celsius.
In this program we get fahrenheit temperature from user and convert that fahrenheit temperature into celsius using following formula
Celsius = (fahrenheit - 32) * 5 / 9

#include <iostream>
#include <math.h>

int main() {
    float temperature;
    std::cout << "Please enter temperature in fahrenheit:";
    std::cin >> temperature;
    float celsius = (temperature - 32) * 5 / 9;
    std::cout << "Temperature in celsius: " << celsius;
}

Output:

Please enter temperature in fahrenheit: 66
Temperature in celsius: 18.8889
On By