Question: C Program An integer n is divisible by 9 if the sum of its digits is divisible by 9. Develop a function to display each

C Program

An integer n is divisible by 9 if the sum of its digits is divisible by 9. Develop a function to display each digit, starting with the rightmost digit. Your program should also determine whether or not the number is divisible by 9. Write a function that calculates the sum of the digits in an int, checks to see if the sum is evenly divisible by 9 and returns 1 for yes and 0 for no. Hint: Use the % and 10 operator to get the least significant digit and use / and 10 to remove the least significant digit. Please use a for-loop, declare variables and only use the library.

Format:

// Function Prototype

//Main Function

//Function

Sample Outputs:

Run 1

Enter an integer: 154368

154368 is divisible by 9

Run 2

Enter an integer: 123456

123456 is NOT divisible by 9

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!