C program to convert temperature from degree fahrenheit to celsius and kelvin - IProgramX

Q. C Program - Accept temperatures in Fahrenheit (F) and print it in Celsius (C) and Kelvin (K)


Program

#include<stdio.h>
#include<conio.h>
int main()
{
float cel,fer,kel;

printf("Enter Temperature in Fahrenheit :");
scanf("%f",&fer);

cel= (fer-32)/1.8 ;
printf("Celsius = %f \n",cel);

kel = (fer-32)/1.8 + 273.15 ; 
printf("Kelvin  = %f \n",kel);

return (0) ;
}

Output:
Enter Temperature in Fahrenheit :56
Celsius = 13.333333
Kelvin  = 286.483337

Post a Comment

0 Comments