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>
#include <iomanip>
using namespace std;
int main(){
// Kelvin temperature
float TempK;
// Fahrenheit temperature
float TempF = 72;
//One line of code to calculate temperature in Kelvin
TempK = (TempF - 32) * 5/9 + 273.15;
cout<<"Temperature in Fahrenheit is: "<<TempF<<"\n\n";
cout<<"Temperature in Kelvin is: "<<TempK<<"\n\n";
cin>>TempK;
return 0;
}
Comments
Leave a comment