HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /A sports watch records the length of a run in minutes…
MediumComputer ScienceHigh School (9–10)Computer Science › Algorithms and Problem-SolvingNumericalIGCSE

A sports watch records the length of a run in minutes…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

A sports watch records the length of a run in minutes. This algorithm turns the minutes into hours and minutes.

pseudocode
INPUT Minutes
Hours ← DIV(Minutes, 60)
Left ← MOD(Minutes, 60)
OUTPUT Hours, " hours ", Left, " minutes"
  1. What is output for the input 135135135?
  1. Explain what DIV and MOD do in this algorithm.

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

Cambridge pseudocode: keywords in capitals, names in mixed case, ← for assignment, INPUT and OUTPUT, IF ... THEN ... ELSE ... ENDIF, CASE OF ... OTHERWISE ... ENDCASE, FOR ... TO ... STEP ... NEXT, WHILE ... DO ... ENDWHILE, REPEAT ... UNTIL. DIV(a, b) is the whole-number quotient and MOD(a, b) the remainder.

The worked solution

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Step 1. DIV. DIV(135, 60) is the whole number of times 606060 goes into 135135135. 2×60=1202 \times 60 = 1202×60=120, and 3×60=1803 \times 60 = 1803×60=180 is too big. So Hours is 222.

Step 2. MOD. MOD(135, 60) is the remainder: 135−120=15135 - 120 = 15135−120=15. So Left is 151515.

Answer: (a) the output is 2 hours 15 minutes. (b) DIV gives the number of whole hours, and MOD gives the minutes left over.

What if? For an input of 595959 the output is 0 hours 59 minutes. For 606060 it is 1 hours 0 minutes. A careful programmer might amend the message for one hour.

Log in to save this for later
← All Problems
← A garden centre sells turf by the square metre…This algorithm outputs the even numbers from 2 to 12… →
More onComputer Science › Algorithms and Problem-Solving

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Writing pseudocodePseudocode, Trace Tables and Testing

More on this topic

  1. This is the kind of long scenario question that ends Paper 2…Hard
  2. A delivery company adds a check digit to each parcel number…Medium
  3. Name the check in each case. Say whether it is validation or verification…Easy
  4. A bubble sort is changed so that it sorts in descending order: the comparison becomes IF…
Hard
  • A shop stores the colours of the ten bicycles in its window in an array Colours: red, blue, red…Medium
  • All problems on this topic →