← Unit 1 · all exercises
Saved in this browser only

How many quarters

A quarter is worth 25 cents. Return how many whole quarters fit into the given number of cents. 60 cents makes 2 quarters, with 10 cents left over that you ignore.

int quarters(int cents)

Solution.java
Loading editor…
Results

Examples

  • quarters(60) → 2
  • quarters(100) → 4

There are also 4 hidden tests you can't see. Solve the problem, not the examples.