Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions