C++ Program to Perform Celsius to Fahrenheit Conversion

C++ Program to Perform Celsius to Fahrenheit Conversion 


This C++ Program performs Celsius to Fahrenheit conversion. The program reads the temperature in Celsius, multiplies the temperature in Celsius by 9 / 5 and adds 32 to obtain temperature in Fahrenheit. Here is source code of the C++ program which performs Celsius to Fahrenheit conversion. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below.

    /*
    * C++ program to perform celsius to fahrenheit conversion
    */
    #include<iostream>
    using namespace std;
    int main()
    {
    float fahrenheit, celsius;
    cout << "Enter the temperature in Celsius : ";
    cin >> celsius;
    fahrenheit = (celsius * 9.0) / 5.0 + 32;
    cout << "The temperature in Celsius : " << celsius << endl;
    cout << "The temperature in Fahrenheit : " << fahrenheit << endl;
    return 0;
    }
      Enter the temperature in Celsius : -40
      The temperature in Celsius : -40
      The temperature in Fahrenheit : -40

      Post a Comment

      Previous Post Next Post