TEMPERATURE
CONVERSION SYSTEM
INTRODUCTION
In this guide, we will explore the fundamentals of temperature
conversion. Understanding how to convert between different
temperature scales is crucial for various fields, including
science, cooking, and engineering. Let's embark on this
journey to master the art of temperature conversion!
UNDERSTANDING TEMPERATURE SCALES
Here are the basics of five common temperature scales:
1. Celsius (°C):
Based on: The freezing (0°C) and boiling points (100°C) of water at 1 atmosphere of pressure.
Used in: Most of the world for scientific, everyday, and weather-related measurements.
Zero point: 0°C is the freezing point of water.
2. Fahrenheit (°F):
Based on: The freezing point of water (32°F) and the boiling point of water (212°F), with 180 increments between
them.
Used in: Primarily in the United States and a few other regions for weather and everyday temperature
measurement.
Zero point: 32°F is the freezing point of water.
3. Kelvin (K):
Based on: Absolute zero (0 K), the lowest possible temperature where particles have minimal thermal motion.
Used in: Scientific measurements, especially in physics and chemistry.
Zero point: 0 K represents absolute zero, or -273.15°C.
Relationship: K = °C + 273.15
4. Rankine (°R or °Ra):
Based on: Similar to Kelvin, but uses Fahrenheit degrees. Absolute zero is 0°R.
Used in: Some engineering fields, especially in thermodynamics.
Zero point: 0°R is absolute zero, or -459.67°F.
Relationship: °R = °F + 459.67.
5. Réaumur (°Ré):
Based on: The freezing (0°Ré) and boiling points (80°Ré) of water.
Used in: Historically in Europe, particularly in scientific and industrial settings.
Zero point: 0°Ré is the freezing point of water.
Relationship: 1°Ré = 1.25°C.
Each of these scales has its own historical and practical context for use, with
Celsius, Fahrenheit, and Kelvin being the most widely used today.
ALGORITHM
1. Display the options for input temperature units (Celsius, Fahrenheit, Kelvin, Rankine, and Reaumur).
2. Accept the user's choice of input temperature unit and the corresponding temperature value.
3. Based on the choice, convert the input temperature to all five units using the appropriate formulas:
Celsius to others:
Fahrenheit = (Celsius * 9/5) + 32
Kelvin = Celsius + 273.15
Rankine = (Celsius + 273.15) * 9/5
Reaumur = Celsius * 4/5
Fahrenheit to others:
Celsius = (Fahrenheit - 32) * 5/9
Kelvin = (Fahrenheit - 32) * 5/9 + 273.15
Rankine = Fahrenheit + 459.67
Reaumur = (Fahrenheit - 32) * 4/9
Kelvin to others:
Celsius = Kelvin - 273.15
Fahrenheit = (Kelvin - 273.15) * 9/5 + 32
Rankine = Kelvin * 9/5
Reaumur = (Kelvin - 273.15) * 4/5
Rankine to others:
Celsius = (Rankine - 491.67) * 5/9
Fahrenheit = Rankine - 459.67
Kelvin = Rankine * 5/9
Reaumur = (Rankine - 491.67) * 4/9
Reaumur to others:
Celsius = Reaumur * 5/4
Fahrenheit = Reaumur * 9/4 + 32
Kelvin = (Reaumur * 5/4) + 273.15
Rankine = (Reaumur * 9/4) + 491.67
4. Display the converted temperatures in all units.
5. Exit the program after conversion.
SOURCE CODE
#include <stdio.h> int main() {
case 4: // Rankine to others
rankine = temp; float temp;
void convert_temperature(float temp, int choice) { int choice;
celsius = (rankine - 491.67) * 5 / 9;
float celsius, fahrenheit, kelvin, rankine, reaumur;
fahrenheit = rankine - 459.67;
switch (choice) {
kelvin = rankine * 5 / 9; printf("Temperature Conversion Program\n");
case 1: // Celsius to others reaumur = (rankine - 491.67) * 4 / 9; printf("Choose the input temperature unit:\n");
celsius = temp; break; printf("1. Celsius\n");
fahrenheit = (celsius * 9 / 5) + 32; printf("2. Fahrenheit\n");
kelvin = celsius + 273.15; case 5: // Reaumur to others
printf("3. Kelvin\n");
rankine = (celsius + 273.15) * 9 / 5; reaumur = temp;
printf("4. Rankine\n");
reaumur = celsius * 4 / 5; celsius = reaumur * 5 / 4;
printf("5. Reaumur\n");
break; fahrenheit = reaumur * 9 / 4 + 32;
kelvin = (reaumur * 5 / 4) + 273.15; printf("Enter your choice (1-5): ");
case 2: // Fahrenheit to others rankine = (reaumur * 9 / 4) + 491.67; scanf("%d", &choice);
fahrenheit = temp; break;
celsius = (fahrenheit - 32) * 5 / 9; if (choice < 1 || choice > 5) {
kelvin = (fahrenheit - 32) * 5 / 9 + 273.15; default: printf("Invalid choice! Exiting...\n");
rankine = fahrenheit + 459.67; printf("Invalid choice!\n"); return 1;
reaumur = (fahrenheit - 32) * 4 / 9; return; }
break; }
case 3: // Kelvin to others
printf("Enter the temperature value: ");
printf("\nConverted Temperatures:\n");
kelvin = temp; scanf("%f", &temp);
printf("Celsius: %.2f°C\n", celsius);
celsius = kelvin - 273.15; printf("Fahrenheit: %.2f°F\n", fahrenheit);
fahrenheit = (kelvin - 273.15) * 9 / 5 + 32; printf("Kelvin: %.2f K\n", kelvin); convert_temperature(temp, choice);
rankine = kelvin * 9 / 5; printf("Rankine: %.2f°R\n", rankine);
reaumur = (kelvin - 273.15) * 4 / 5; return 0;
printf("Reaumur: %.2f°Ré\n", reaumur);
break;
} }
CONCLUSION
The C program for temperature conversion between five units—Celsius, Fahrenheit,
Kelvin, Rankine, and Reaumur—demonstrates the efficiency of using mathematical
formulas to convert temperatures across different scales. The program ensures
accuracy and provides the user with the flexibility to input a temperature in one unit
and quickly convert it to all others.
This solution simplifies temperature conversion by allowing users to avoid manual
calculations and reduce errors. It is a useful tool for various applications, from
scientific research to everyday tasks, where temperature data needs to be compared
or converted between different units.
THANK
YOU