Create a Temperature Converter

CBeginner
Practice Now

Introduction

In this challenge, you will develop a temperature conversion tool in C to support international scientific collaboration. As a junior climate research assistant, you need to create a program that can convert temperatures between Celsius and Fahrenheit. The program should accept user input for Celsius temperature and display the corresponding Fahrenheit temperature with two decimal places.

Build a Temperature Conversion Tool

As a junior climate research assistant, you need to develop a quick utility for converting temperatures between Celsius and Fahrenheit to support international scientific collaboration.

Tasks

  • Create a C program that converts Celsius temperatures to Fahrenheit
  • Implement the conversion formula: F = (C * 9/5) + 32
  • Accept user input for Celsius temperature
  • Display the converted Fahrenheit temperature

Requirements

  • Create a file named temperature_converter.c in the ~/project directory
  • Use arithmetic operators for temperature conversion
  • Prompt the user to enter a temperature in Celsius
  • Print the converted temperature in Fahrenheit with two decimal places
  • Handle decimal input for temperature conversion

Examples

Compile and run the program:

gcc temperature_converter.c -o temperature_converter
./temperature_converter

Input:

Enter temperature in Celsius: 25

Output:

25.00°C is equal to 77.00°F

Hints

  • Use scanf() to get user input
  • Remember the temperature conversion formula
  • Use printf() to display the result
  • Use %.2f format specifier for decimal output

Summary

In summary, this challenge requires you to develop a temperature conversion tool in C that can convert temperatures between Celsius and Fahrenheit. The program should accept user input for Celsius temperature and display the corresponding Fahrenheit temperature with two decimal places. The key tasks include implementing the temperature conversion formula, handling user input, and formatting the output.

✨ Check Solution and Practice