Guest User

Untitled

a guest
Jan 22nd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.95 KB | None | 0 0
  1.   //By Philson Wong
  2.   //track.c             14 Oct
  3. #include <stdio.h>
  4. #define fpm 5280
  5. #define fpk 3282
  6.  
  7. void instruct();
  8.  
  9. int main()
  10. {
  11.   double mins, secs, fps, mps;
  12.  
  13.   instruct();
  14.  
  15.   printf("Minutes for the runner: "); //Prompt for the minutes
  16.   scanf("%lf", &mins);
  17.   printf("Seconds for the runner: "); //Prompt in seconds, lf
  18.   scanf("%lf", &secs);
  19.  
  20.   fps = fpm / ((mins * 60) + secs);
  21.  
  22.   mps = fpm * 1000 / (fpk * (mins * 60 + secs)); //Equation is same as fps, except converted
  23.  
  24.   printf("That is %.1lf feet per second, and %.2lf meters per second.\n", fps, mps);
  25.  
  26.   return (0);  //Return of integer expected
  27. }
  28.  
  29.  
  30.  
  31. void instruct()
  32. {
  33.   printf("This program will ask for the minutes and seconds for the time it\n");
  34.   printf("took for a runner to run a mile.  The program will then calculate\n");
  35.   printf("the feet per second and meters per second for that runner.\n\n");
  36.   //Acts as prompt, called by instruct(); in the main function
  37. }
Add Comment
Please, Sign In to add comment