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 stopwatch app stores a time as a number of seconds…
MediumComputer ScienceHigh School (9–10)Computer Science › ProgrammingNumericalIGCSE

A stopwatch app stores a time as a number of seconds…

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 stopwatch app stores a time as a number of seconds. This pseudocode turns it into minutes and seconds.

pseudocode
DECLARE TotalSeconds : INTEGER
DECLARE Minutes : INTEGER
DECLARE Seconds : INTEGER
INPUT TotalSeconds
Minutes ← DIV(TotalSeconds, 60)
Seconds ← MOD(TotalSeconds, 60)
OUTPUT Minutes, " minutes ", Seconds, " seconds"

Dry-run the program for the input 500. What are the values of Minutes and Seconds? Then find the input that gives 3 minutes 0 seconds and is larger than every other input that does.

Check your answer

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

Need a reminder? The key ideaShowHide

A variable is declared with its type: DECLARE Name : INTEGER. The five types are INTEGER, REAL, CHAR, STRING and BOOLEAN. A constant takes a literal: CONSTANT Name ← 5. Assignment is ←; = compares. DIV(A, B) is the whole part of A÷BA \div BA÷B, and MOD(A, B) is 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. The minutes. 606060 fits into 500500500 eight whole times, because 8×60=4808 \times 60 = 4808×60=480. So Minutes is 8.

Step 2. The seconds. 500−480=20500 - 480 = 20500−480=20. So Seconds is 20. The output is 8 minutes 20 seconds.

Step 3. The second question. We need DIV(T, 60) = 3 and MOD(T, 60) = 0. Only one input does that: T=3×60=180T = 3 \times 60 = 180T=3×60=180. So the largest such input, and the only one, is 180.

Check. 8×60+20=5008 \times 60 + 20 = 5008×60+20=500. The two parts put back together give the input.

Answer: Minutes is 8 and Seconds is 20; the input is 180.

Log in to save this for later
← All Problems
← A school library keeps a record for each book…A student wrote this pseudocode to find the area of a floor in square metres and the number of… →
More onComputer Science › Programming

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Variables, constants, data types, input and outputVariables, Selection and Loops in Pseudocode

More on this topic

  1. A long scenario question. A teacher has the names of 5 students in the file Names.txt, one name a…Hard
  2. Shopping.txt holds six lines: bread, rice, milk, eggs, tea and jam…Medium
  3. The file Best.txt holds one line: 120. What is output, and what does Best.txt hold afterwards, when…Easy
The nine squares of a board are input row by row: X, O, O, then X, X, X, then O, a dot for an empty…Hard
  • Three teams play three games each. Points[Team, Game] holds the points of a team in a game…Medium
  • All problems on this topic →