shelling (owner)

Revisions

gist: 203972 Download_button fork
public
Public Clone URL: git://gist.github.com/203972.git
Embed All Files: show embed
assignment-3.c #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#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;
}