Experiment no: 01
Experiment Name: Temperature Conversion from Fahrenheit to Celsius.
Objective: To write a C program that takes a temperature in Fahrenheit as input from the user
and converts it to Celsius using the formula:
(F − 32)
𝐶=
1.8
Where:
• F is the temperature in Fahrenheit
• C is the temperature in Celsius
Algorithm:
1. Start the program.
2. Declare variables for Fahrenheit (float) and Celsius (float).
3. Prompt the user to input temperature in Fahrenheit.
4. Apply the conversion formula.
5. Display the result in Celsius.
6. End the program.
Source code:
#include <stdio.h>
int main()
float fahrenheit, celsius;
printf("Enter temperature in Fahrenheit: ");
scanf("%f", &fahrenheit);
celsius = (fahrenheit - 32) / 1.8;
printf("Temperature in Celsius: %.2f\n", celsius);
return 0;
}
Output:
Coment:
The program successfully takes a temperature input in Fahrenheit and converts it into Celsius us-
ing a mathematical formula. The task demonstrates effective use of arithmetic operations, varia-
ble handling, and user input/output in C programming.