C++ Code Example: convert celsius to fahrenheit

This C++ program converts Celsius to Fahrenheit. First, the user is asked to enter a temperature in Celsius of type float. After that the value is converted to Fahrenheit.

The formula for the conversion is:
fahrenheit = celsius * 1,8 +32

#include <iostream>
using namespace std;

int main() {
    double c, f;

    cout << "Please enter temperature in celsius: ";
    cin >> c;

    f = c * 1.8 + 32;

    cout << "Temperature in fahrenheit: " << f << endl;

    return 0;
}
Output
Please enter temperature in celsius: 10
Temperature in fahrenheit: 50