# C++ Program to Convert Celsius to Kelvin

In this post, we will learn how to convert temperature from degree Celsius to Kelvin using the C++ Programming language.

To convert the temperature from degree Celsius to Kelvin, we add 273.15 to the Celsius scale. This gives us the temperature in the Kelvin scale.

The below program asks the user to enter the temperature in degree Celsius, then it converts it into Kelvin using the formula: Kelvin = Celsius + 273.15.

So, without further ado, let’s begin this post.

Contents

## C++ Program to Convert Celsius to Kelvin

```// C++ Program to Convert Celsius to Kelvin
#include <iostream>
using namespace std;

int main(){
float celsius, kelvin;

cout << "Enter the temperature in Celsius: ";
cin >> celsius;

// Celsius to kelvin
kelvin = celsius + 273.15;

// Display Output
cout << "The temperature in the Kelvin scale: " << kelvin << endl;
return 0;
}
```

Output

``````Enter the temperature in Celsius: 42.8
The temperature in the Kelvin scale: 315.95
``````

## How Does This Program Work?

```    float celsius, kelvin;
```

In this program, we have declared two floating data type variables named celsius and kelvin.

```    // Asking for input
cout << "Enter the temperature in Celsius: ";
cin >> celsius;
```

The user is asked to enter the temperature in degree Celsius. The value gets stored in the celsius named variable.

```    // Celsius to kelvin
kelvin = celsius + 273.15;
```

The temperature is converted from degree Celsius to Kelvin using the formula: Kelvin = Celsius + 273.15. The temperature in Kelvin scale gets stored in the kelvin named variable.

```    // Display Output
cout << "The temperature in Kelvin scale: " << kelvin << endl;
```

Finally, the temperature in the Kelvin scale is displayed on the screen using the cout statement.

## Conclusion

I hope after going through this post, you understand how to convert temperature in degree Celsius to Kelvin using the C++ Programming language.

If you have any doubt regarding the program, then contact us in the comment section. We will be delighted to assist you.