In this article, you’ll learn how to convert temperature in Celcius to Fahrenheit—and vice-versa.
How to Convert Temperature in Celcius to Fahrenheit
You can convert the temperature in Celcius to Fahrenheit using the following formula:
You need to multiply the °C temperature by 9/5 and add 32 to it. The result will be in °F.
Problem Statement
You’re given a temperature num in °C, you need to convert it into °F. Example 1: Let num = 100. Therefore, the temperature in °F = (100 x 9/5) + 32 = 212 Thus, the output is 212. Example 2: Let num = 0. Therefore, the temperature in °F = (0 x 9/5) + 32 = 32 Thus, the output is 32.
C++ Program to Convert Temperature in Celcius to Fahrenheit
Below is the C++ program for Celcius to Fahrenheit conversion:
Output:
Python Program to Convert Temperature in Celcius to Fahrenheit
Below is the Python program for Celcius to Fahrenheit conversion:
Output:
JavaScript Program to Convert Temperature in Celcius to Fahrenheit
Below is the JavaScript program for Celcius to Fahrenheit conversion:
Output:
How to Convert Temperature in Fahrenheit to Celcius
You can convert the temperature in Fahrenheit to Celcius using the following formula:
You need to subtract 32 from the °F temperature and then multiply it by 5/9. The result will be in °C.
Problem Statement
C++ Program to Convert Temperature in Fahrenheit to Celcius
Below is the C++ program for Fahrenheit to Celcius conversion:
Output:
Python Program to Convert Temperature in Fahrenheit to Celcius
Below is the Python program for Fahrenheit to Celcius conversion:
Output:
JavaScript Program to Convert Temperature in Fahrenheit to Celcius
Below is the JavaScript program for Fahrenheit to Celcius conversion:
Output:
Converting Celsius to Fahrenheit Doesn’t Need to Be Difficult
So, there you have it—now you know how to convert Celsius to Fahrenheit—and vice versa. Knowing the two main temperature types is important, especially if you do any kind of work in both the US (or the small selection of other places that use Fahrenheit) and other countries.
The best way to learn to program is by developing projects. Developing projects help you to become a better programmer. If you’re new to programming and looking for some beginner-level projects, you can try developing some projects like a chess game, calculator, digital clock, simple website, to-do list app, and so on.