Question: Homework program C An integer n is divisible by 9 if the sum of its digits is divisible by 9. Develop a function to display
Homework program C
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. Test it on the following numbers: n = 154368 n = 621594 n = 123456 Hint: Use the % and 10 operator to get the least significant digit and use / and 10 to remove the least significant digit. Sample output:
Run 1: IS IT DIVISIBLE BY 9
Enter an integer: 154368 154368 is divisible by 9
Run 2: IS IT DIVISIBLE BY
9 Enter an integer: 123456 123456 is NOT divisible by 9
// Preprocessor directives
// Function prototypes
// Main function
// Function for Coding Problem
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
