Q:

C Program for Fahrenheit to Kelvin conversion

0

In this exercise, we learn how to write a C program to convert Fahrenheit to Kelvin ?. We will write the C program to convert Fahrenheit to Kelvin. Write a C program to input temperature in Fahrenheit and convert it to Kelvin. How to convert temperature from degree Fahrenheit to degree Kelvin in C programming. Logic to convert temperature from Fahrenheit to Kelvin in C.

Example,

Input : F = 100
Output : K = 311.28
 
 
Input : F = 110
Output : K = 283.50

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

The below program ask the user to enter the temperature in Fahrenheit. After getting the temperature in Fahrenheit from the user program convert it in Kelvin.

#include <stdio.h>
float convertFahKelvin(float F )
{
    return 273.5 + ((F - 32.0) * (5.0/9.0));
}
int main()
{
    float kelvin, fahrenheit;
    printf("Enter temperature in fahrenheit: ");
    scanf("%f", &fahrenheit);
    //called function to convert fahrenheit to kelvin
    kelvin = convertFahKelvin(fahrenheit);
    printf("%.2f Fahrenheit = %.2f Kelvin",fahrenheit,kelvin);
    return 0;
}

Output:

Enter temperature in Fahrenheit: 100
100.00 Fahrenheit = 311.28 Kelvin

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now