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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

With a Progressive Tax, the greater one's ability to pay a tax

Answered: 1 week ago

Question

4. Who would lead the group?

Answered: 1 week ago

Question

Where those not participating, encouraged to participate?

Answered: 1 week ago