text: Convert a given temperature to another system based on given boiling and freezing points | C program for above approach ; Function to return temperature in the second thermometer ; Calculate the temperature ; Driver Code
code: #include <stdio.h> NEW_LINE double temp_convert ( int F1 , int B1 , int F2 , int B2 , int T ) { float t2 ; t2 = F2 + ( float ) ( B2 - F2 ) / ( B1 - F1 ) * ( T - F1 ) ; return t2 ; } int main ( ) { int F1 = 0 , B1 = 100 ; int F2 = 32 , B2 = 212 ; int T = 37 ; float t2 ; printf ( " % .2f " , temp_convert ( F1 , B1 , F2 , B2 , T ) ) ; return 0 ; }