C Program to Convert Kelvin to Fahrenheit

In this post, we will learn how to convert Kelvin to Fahrenheit using the C Programming language.

Both Kelvin and Fahrenheit are temperature scales used to measure the temperature of an object. However, Kelvin is an absolute scale with its zero at absolute zero. 

The formula to convert Kelvin to Fahrenheit is: F = 9/5(273.15) + 32.

We will use the above formula in our program for the conversion process.

So, without further ado, let’s begin this tutorial.

C Program to Convert Kelvin to Fahrenheit

// C Program to Convert Kelvin to Fahrenheit
#include <stdio.h>
int main(){
    float kel, F;
    
    // Taking input
    printf("Enter the temperature in Kelvin: ");
    scanf("%f", &kel);
    
    // Kelvin to fahrenheit conversion
    F = ((9.0 / 5) * (kel - 273.15)) + 32;
    
    // Display output
    printf("%.2f Kelvin = %.2f Fahrenheit", kel, F);
    return 0;
}

Output

Enter the temperature in Kelvin: 310
310.00 Kelvin = 98.33 Fahrenheit

How Does This Program Work?

    float kel, F;

In this program, we have declared two floating data type variables named kel and F.

    // Taking input
    printf("Enter the temperature in Kelvin: ");
    scanf("%f", &kel);

Then, the user is asked to enter the temperature in the Kelvin scale.

    // Kelvin to fahrenheit conversion
    F = ((9.0 / 5) * (kel - 273.15)) + 32;

We convert the temperature from Kelvin to degree Fahrenheit using the conversion formula: F = 9/5(273.15) + 32.

    // Display output
    printf("%.2f Kelvin = %.2f Fahrenheit", kel, F);

Finally, the temperature in degree Fahrenheit is displayed on the screen using the printf() function.

Conclusion

I hope after going through this post, you understand how to convert Kelvin to Fahrenheit using the C Programming language.

If you have any doubt regarding the program, then contact us in the comment section. We will be delighted to assist you.

Also Read:

Leave a Comment

Your email address will not be published. Required fields are marked *