03_SampleC_Program
03_SampleC_Program
Purpose: Given a distance in meters and the speed of a car in miles per
hour (mph), calculate how many minutes it will take for that car to
travel that distance.
#include <stdio.h>
#define METERS_PER_MILE 1609.344
return (0);
}
#include <stdio.h>
int main (void)
{double x, y, s, h, m;
printf ("Enter the distance in meters: "); scanf ("%lf", &x);
printf ("Enter the speed of the car in mph: "); scanf ("%lf", &s);
y = x / 1609.344; h = y / s; m = h * 60;
printf ("The car will travel %0.2f meters in %0.1f minutes.\n", x, m);
return (0);}