You are on page 1of 6

Lab Report # 02

EE-112L - Programming Fundamentals Lab


by
Ausaf Ahmad
Section: A

Reg. # 20MDELE136
Class No.: 18

Instructor

Engr. Jawad Ali


Lecturer

Department of Electrical Engineering,

University of Engineering and Technology


Mardan

DATED: 04/04/2021
Task: Taking Input at Run Time.

Below is the code for converting the given temperature from

Fahrenheit to Celsius.

This code is taking input from user at run time.

CODE:

// Fahrenheit to Celsius in C

// ----Lab Report # 02-----

// ----20MDELE136-----

// ----AUSAF AHMAD-----
#include<stdio.h>

int main()

printf("This program is taking input from user at

run time as the user is required to given the temperature

at run time\n");

printf("\n");

float fahrenheit, celsius;

printf("Enter Temperature Value (in Fahrenheit): ");


scanf("%f", &fahrenheit);

celsius = (fahrenheit-32)/1.8; //formula for celsius to

fahrenheit is: celsius = (fahrenheit-32)/(180/100) As

180/100=1.8

printf("\nEquivalent Temperature (in Celsius) =

%0.2f", celsius);

return 0;

}
Snap-A (i.e. CODE)

Result:
Snap-B (Result)

The End

You might also like