Exercise 4:
Temperature of a city in Fahrenheit degree is input through the keyboard. Write a program to convert this temperature into centigrade degree.
Solution:
The output of the program is as follows:
Enter the temperature in degree Fahrenheit = 122
Therefore the corresponding temperature in degree centigrade = 50.0000
Temperature of a city in Fahrenheit degree is input through the keyboard. Write a program to convert this temperature into centigrade degree.
Solution:
#include<stdio.h>In this program the temperature in degree Fahrenheit is inputted from the user and then calculating the corresponding centigrade temperature, the result is then displayed to the user.
#include<conio.h>
void main()
{
float df, dc;
printf(“Enter the temperature in degree Fahrenheit = ”);
scanf(“%f”, &df);
dc=(df-32)*5/9;
printf(“\nTherefore the corresponding temperature in degree centigrade = %f”, dc);
getch();
}
The output of the program is as follows:
Enter the temperature in degree Fahrenheit = 122
Therefore the corresponding temperature in degree centigrade = 50.0000
No comments:
Post a Comment
Please give your valuable comments or queries if you fell its helpful or if you like the contents of the site. Thanks...