205k views
2 votes
Write a line of code to convert time to hours. Remember there are 60 minutes in an hour. Then write a line of code to calculate the speed of each runner in miles per hour. Speed is distance divided by time.

a. hours <- time / 60; speed <- distance / hours
b. hours <- time / 60; speed <- distance * hours
c. hours <- time * 60; speed <- distance / hours
d. hours <- time * 60; speed <- distance * hours

User Greg Lowe
by
7.6k points

1 Answer

6 votes

Final answer:

The correct line of code to convert time to hours is 'hours <- time / 60', and to calculate speed in miles per hour, use 'speed <- distance / hours'.

Step-by-step explanation:

The correct line of code to convert time to hours is:

a. hours <- time / 60;

To calculate the speed of each runner in miles per hour, you would use:

speed <- distance / hours

By dividing the time by 60, you can convert the time in minutes to hours. Then, dividing the distance by the time in hours will give you the speed in miles per hour.

User Acabezas
by
7.7k points