p.252, icon at Example 2 #1. Certain rules allow us to determine by inspection when a positive integer n is divisible by a positive integer k. For example, 5❘n if and only if n ends in the digit 5 or 0. Similarly, 2❘n if and only if n ends in one of the digits 0, 2, 4, 6, 8. There is also a rule to determine divisibility by 3: 3❘n if and only if the sum of the digits in n is divisible by 3. For example 3 | 478, 125 because the sum of the six digits in 478, 125 is 27, which is divisible by 3. Why does the rule work?

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 21PE
icon
Related questions
Question
p.252, icon at Example 2
#1. Certain rules allow us to determine by inspection when a positive integer n is divisible by a positive integer k.
For example, 5❘n if and only if n ends in the digit 5 or 0. Similarly, 2❘n if and only if n ends in one of the digits
0, 2, 4, 6, 8.
There is also a rule to determine divisibility by 3:
3❘n if and only if the sum of the digits in n is divisible by 3.
For example 3 | 478, 125 because the sum of the six digits in 478, 125 is 27, which is divisible by 3. Why does the rule
work?
Transcribed Image Text:p.252, icon at Example 2 #1. Certain rules allow us to determine by inspection when a positive integer n is divisible by a positive integer k. For example, 5❘n if and only if n ends in the digit 5 or 0. Similarly, 2❘n if and only if n ends in one of the digits 0, 2, 4, 6, 8. There is also a rule to determine divisibility by 3: 3❘n if and only if the sum of the digits in n is divisible by 3. For example 3 | 478, 125 because the sum of the six digits in 478, 125 is 27, which is divisible by 3. Why does the rule work?
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr