Minutes to Hours
JavaScript
20 pts
Minutes to Hours
The bus from Asmara to Keren takes totalMinutes = 135 minutes. Convert it to hours and minutes with arithmetic:
minutes= what is left over after full hours (use%)hours= the number of full hours: subtract the left-over minutes fromtotalMinutesand divide by 60
Then Abel travels there and back. Create let trips = 0; and use ++ twice to make it 2. Print exactly:
135 minutes = 2 h 15 min Trips: 2 - time on the bus: 270 minutes
The 270 must be calculated as totalMinutes * trips.
Checklist
- Calculate the left-over
minuteswith%. - Calculate the full
hours. - Count the trips with
++. - Calculate the bus time without typed answers.
- Print the two lines.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
