#include <stdio.h>
#define TRANSIT 72
#define PERIOD 1.5
#define MISSION 10
int
main (void)
{
double time;
int orbit;
printf ("Mission to the Moon - Times in hours\n");
printf ("====================================\n");
time = 0.0;
printf ("Time - %4.1lf - Mission begins\n", time);
time = time + TRANSIT;
printf ("Time = %4.1lf - At the moon\n", time);
orbit = 1;
while (orbit <= MISSION)
{
time = time + PERIOD;
printf ("Time = %4.1lf - %2d orbits completed\n", time, orbit);
orbit = orbit + 1;
}
time = time + TRANSIT;
printf ("Time = %5.1lf - Mission complete.\n", time);
return (0);
}
Mission to the Moon - Times in hours
====================================
Time - 0.0 - Mission begins
Time = 72.0 - At the moon
Time = 73.5 - 1 orbits completed
Time = 75.0 - 2 orbits completed
Time = 76.5 - 3 orbits completed
Time = 78.0 - 4 orbits completed
Time = 79.5 - 5 orbits completed
Time = 81.0 - 6 orbits completed
Time = 82.5 - 7 orbits completed
Time = 84.0 - 8 orbits completed
Time = 85.5 - 9 orbits completed
Time = 87.0 - 10 orbits completed
Time = 159.0 - Mission complete.