Question: 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,

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 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

Write in C language please...

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!