Created
October 7, 2009 11:11
-
-
Save shelling/203972 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <tgmath.h> | |
| // Fortunately, all three functions required in this assignment | |
| // is one-liner...XD | |
| static inline double speed_at_temperature( int temperature ); | |
| static inline void instructions( void ); | |
| static inline double TRUNC( double digits ); | |
| int main( void ) { | |
| double given_temp; | |
| instructions(); | |
| scanf( "%lf", &given_temp ); | |
| printf( "Speed is %.2f", TRUNC( speed_at_temperature( given_temp ) ) ); | |
| return 0; | |
| } | |
| static inline double speed_at_temperature( int temperature ) { | |
| return 1086.L * sqrt( ( 5.L * temperature + 297.L ) / 247.L ); | |
| } | |
| static inline void instructions( void ) { | |
| printf( "please give a number as temperature: " ); | |
| } | |
| static inline double TRUNC( double digits ) { | |
| return trunc( 100 * digits ) / 100.L; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment