Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Task 5: Divisibility Test by 3 and 9 An integer is divisible by 3 and 9 if and only if the sum of its digits
Task 5: Divisibility Test by 3 and 9 An integer is divisible by 3 and 9 if and only if the sum of its digits is divisible by 3 and 9 . For example, suppose n=27193257. Then s=2+7+1+9+3+2+5+7=36. Because 36 is divisible by both 3 and 9 , it follows that 27193257 is divisible by both 3 and 9. we write a C program (task5.c ) that determines whether a positive integer is divisible by 3 and 9 by first finding the sum of its digits and then checking whether the sum is divisible by 3 and 9. [use do while loop only] Examples to test: Enter a positive integer: 27193257 The sum of the digits =36 27193257 is divisible by 3 27193257 is divisible by 9 Enter a positive integer: 161905102 The sum of the digits =25 161905102 is not divisible by 3 161905102 is not divisible by 9
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started