2. write a simple program to convert the temperature from Farenheit to Celsius


 Program to convert the temperature from Fahrenheit to Celsius

Source Code:

#include<stdio.h>
int main()
{
float f,c;
printf("Enter the value of temperature in CELSIUS\n");
scanf("%f",&c);
f=32+(9*c/5);
printf(" temperature in FAHRENHEIT is  %f \n",f);
printf("Enter the value of temperature in FAHRENHEIT\n");
scanf("%f",&f);
c=5*((f-32)/9);
printf(" temperature in CENTIGRADE is %f \n",c);
return 0;
}

Output:

Enter the value of temperature in CELSIUS
100
temperature in FAHRENHEIT is  212.000000
Enter the value of temperature in FAHRENHEIT
32
temperature in CENTIGRADE is 0.000000

No comments:

Post a Comment