编辑代码


#include <math.h>
#include <stdio.h>


float resistanceToTemperature(float _R1, float _B, float _R2, float _T2)
{
    return (1.0 / ((1.0 / _B) * log(_R1 / _R2) + (1.0 / (_T2 + 273.15))) - 273.15);
}


/* main */
int main () {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
    printf("Hello world!     - c.jsrun.net.");
    float tmp = resistanceToTemperature(25, 3470, 5000, 25);
    printf("temp = %0.2f\n", tmp);
    return 0;
}