Przeliczanie temperatur Celcjusz - Fahrenheit - Programowanie Ansi C
/* Przeliczanie temperatur Celcjusz - Fahrenheit - Programowanie Ansi C */ #include <stdio.h> /* ****************************** */ double Cel2Fahr ( double ); double Fahr2Cel ( double ); /* ****************************** */ int main ( void ) { double c,f; printf("\nGive temperature (Celcius) --> "); scanf("%lf",&c); printf("In Fahrenheit is --> %1.15lf\n",Cel2Fahr(c)); printf("Give temperature (Fahrenheit) --> "); scanf("%lf",&f); printf("In Celcius is --> %1.15lf\n",Fahr2Cel(f)); return 0; }
/* ****************************** */ /* convert Celcius temperature into Fahrenheit's */ /* ****************************** */ double Cel2Fahr ( double T ) { return T * (9.0 / 5.0) + 32; } /* ****************************** */ /* convert Fahrenheit temperature into Celcius*/ /* ****************************** */ double Fahr2Cel ( double T ) { return (5.0 / 9.0) * (T - 32); } /* ****************************** */
2012.11.22 22:29:07.