C++ Program to convert temperature from Celsius to Fahrenheit

In this program, we will learn about converting the given temperature from Celsius to Fahrenheit. Here you will learn how an arithmetic expressions is used in a C++ program.

Code for C++ Program to convert Celsius to Fahrenheit:-

#include<iostream>

using namespace std;

int main()
{
    float celsius;

    // taking input in degree celsius
    cout << "Enter the temperature in celsius: ";
    cin >> celsius;

    // calculating fahrenheit
    float fahrenheit = (celsius * 1.8) + 32;

    // printing fahrenheit
    cout << "The temperature is " << fahrenheit << " degree fahrenheit.";
    return 0;
}

Output:-

Enter the temperature in celsius: 85
The temperature is 185 degree fahrenheit.
Enter the temperature in celsius: -40
The temperature is -40 degree fahrenheit.

Now, You can try to convert temperature from Fahrenheit to Celsius.

You can learn about many other C++ Programs Here.







The following two tabs change content below.
Amit Rawat

Amit Rawat

Founder and Developer at SpiderLabWeb
I love to work on new projects and also work on my ideas. My main field of interest is Web Development.

You may also like...