A simple and efficient command-line application written in C that converts temperatures between Celsius and Fahrenheit.
- Convert Celsius → Fahrenheit
- Convert Fahrenheit → Celsius
- User-friendly input via terminal
- Handles invalid input gracefully
- Uses
switch-caseand standard C functions
-
C Programming Language
-
Standard Libraries:
stdio.hctype.h
-
User selects the unit type:
Cfor CelsiusFfor Fahrenheit
-
User enters the temperature value
-
Program performs the conversion
-
Result is displayed instantly
-
Celsius to Fahrenheit:
F = (C × 9/5) + 32 -
Fahrenheit to Celsius:
C = (F − 32) × 5/9
Is the temperature in (F) or (C)?: C
Enter the temperature in Celsius: 25
Temperature in Fahrenheit: 77.0
Is the temperature in (F) or (C)?: F
Enter the temperature in Fahrenheit: 77
Temperature in Celsius: 25.0
- If the user enters an invalid unit:
X is not a valid unit.
temperature-converter/
│── temp.c
│── README.md
- Understanding of
switch-case - Input handling using
scanf - Use of
toupper()for normalization - Basic mathematical operations in C
- Writing clean and readable code
- Add menu-driven interface
- Support continuous conversions using loops
- Implement functions for better modularity
- Add input validation for numeric values
Sai Suraj
This project is built for practice and learning purposes as part of improving C programming fundamentals.