C Program to Convert Temperature in Fahrenheit to Celsius and Kelvin
Write a C program to convert temperature given in fahrenheit to temperature in degree Celsius and degree Kelvin.
C Program:
/*Aim: Accept temperature in Fahrenheit(F) and print it in Celsius(C) and kelvin(K) */
#include<stdio.h>
int main()
{
float far,c,k;
printf("\n Enter Farenheit Temperature: ");
scanf("%f",&far);
c=5*(far-32)/9;
k=c+273.15;
printf("\n The Temperature in Celcius is %f",c);
printf("\n \n The Temperature in Kelvin is %f \n \n",k);
}
Output:
Enter Farenheit Temperature: 32 The Temperature in Celcius is 0.000000 The Temperature in Kelvin is 273.149994
Comments