0% found this document useful (0 votes)
3 views2 pages

Programming-Lab-Report

Lab

Uploaded by

simplepolash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Programming-Lab-Report

Lab

Uploaded by

simplepolash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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.

You might also like