Chapter 13 Exercises With a Quotient and a Remainder

13.1 Introduction

What types of problems might require the use of the quotient and the remainder of an integer division? While there may not be a simple answer to this question, quotients and remainders can be used to:

split a number into individual digits
examine if an integer is odd or even
examine if a number is a multiple of another number
convert an elapsed time (in seconds) to hours, minutes, and seconds
convert an amount of money (in USD) to a number of $100 notes, $50 notes, $20 notes, and such
calculate the greatest common divisor
determine if a number is a palindrome
count the number of digits within a number
determine how many times a specific digit occurs within a number ...

Get C# and Algorithmic Thinking for the Complete Beginner now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.