The formula below decribes how to convert a temperature on the Fahrenheit scale to a temperature on the Kelvin scale.
TempK = (TempF − 32) × 5/9 + 273.15
Using the variables below Write one line of code to implement the formula
// Kelvin temperature
float TempK;
// Fahrenheit temperature
float TempF = 72;
//One line of code to calculate temperature in Kelvin
---------------------------------------------------------------------------
#include <iostream>
using namespace std;
int main()
{
// Kelvin temperature
float TempK;
// Fahrenheit temperature
float TempF = 72;
TempK = (TempF- 32) * (5/9 + 273.15);
cout<<"Temperature in Kelvin is: "<<TempK;
return 0;
}
Comments
Leave a comment