C Program to Convert Temperature given in Celsius to Fahrenheit and Kelvin
This C program converts temperature given in Celsius to Fahrenheit and Kelvin.
This program uses following temperature converter formula:
Fahrenheit = 1.8 * Celsius + 32
Kelvin = 273.15 + Celsius
C Source Code: Temperature Conversion
#include<stdio.h>
#include<conio.h>
int main()
{
float celsius, fahr, kelvin;
clrscr();
printf("Enter temperature in celsius: ");
scanf("%f", &celsius);
fahr = 1.8 * celsius + 32.0;
kelvin = 273.15 + celsius;
printf("%0.2f Celsius = %0.2f Fahrenheit\n", celsius, fahr);
printf("%0.2f Celsius = %0.2f Kelvin",celsius, kelvin);
getch();
return(0);
}
Output of the above program:
Enter temperature in celsius: 47↲ 47.00 Celsius = 116.60 Fahrenheit 47.00 Celsius = 320.15 Kelvin Note: ↲ indicates ENTER is pressed.