Using the CelsiusToKelvin function as a guide, create a new function, changing the name to KelvinToCelsius, and modifying the function accordingly.

#include

double CelsiusToKelvin(double valueCelsius) {
double valueKelvin = 0.0;

valueKelvin = valueCelsius + 273.15;

return valueKelvin;
}


int main(void) {
double valueC = 0.0;
double valueK = 0.0;

valueC = 10.0;
printf("%lf C is %lf K\n", valueC, CelsiusToKelvin(valueC));

valueK = 283.15;
printf("%lf is %lf C\n", valueK, KelvinToCelsius(valueK));

return 0;
}

Respuesta :

Answer:

The function modification to this question can be given as follows:

Modification Function:

double KelvinToCelsius(double valueKelvin) //defining method KelvinToCelsius

{

double valueCelsius = valueKelvin - 273.15; //defining variable valueCelsius and calculate value

return valueCelsius; //return value

}

The whole program to this question as follows:

Program:

#include <stdio.h> //include header file to use basic functions

double CelsiusToKelvin(double valueCelsius)//defining method CelsiusToKelvin

{

double valueKelvin = 0.0; //defining variable and assign a value

valueKelvin = valueCelsius + 273.15; //calculate value

return valueKelvin; //return value

}

double KelvinToCelsius(double valueKelvin) //defining method KelvinToCelsius

{

double valueCelsius = valueKelvin - 273.15; //defining variable valueCelsius and calculate value

return valueCelsius; //return value

}

int main() //defining main method

{

double valueC = 0.0,valueK = 0.0; //defining variable valueC and valueK assign value

valueC = 10.0; //change variable value

printf("%lf C is %lf K\n", valueC, CelsiusToKelvin(valueC));

valueK = 283.15; //change variable value

printf("%lf is %lf C\n", valueK, KelvinToCelsius(valueK));

return 0;

}

Output:

10.000000 C is 283.150000 K

283.150000 is 10.000000 C

Explanation:

In the above modification function, a function "KelvinToCelsius" is defined, which accepts double variable "valueKelvin" as a parameter, and the function returns a value, which is double type. Inside a function, another double variable valueCelsius is defined, which minus 273.15 from parameter value and, store this value in valueCelsius variable.

Answer:

public static double kelvinToCelsius ( double valueKelvin ){

     double valueCelsius;

     

     valueCelsius = valueKelvin - 273.15;

     

     return valueCelsius;

     }

Explanation:

Ver imagen DarthVaderBarbie