Write a C program to accept temperatures in Fahrenheit (F) and display it in Celsius(C) and Kelvin (K) (Hint: C=5.0/9(F-32), K = C + 273.15)
#include<stdio.h>
#include<conio.h>
void main()
{
float fahrenheit,convert;
//Accept temperature
printf("\nEnter temperature in fahrenheit:");
scanf("%f",&fahrenheit);
convert=(fahrenheit - 32) * 5/9; // Formula C=5.0/9(F-32)
//To display temperature
printf("\nTemperature in celsius: %f",convert);
}
0 Comments