Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C programming. Example output: An integer is divisible by 9 if the sum of its digits is divisible by 9. Exp: 154368 1+5+4+3+6+8 = 27

image text in transcribed

C programming.

Example output: An integer is divisible by 9 if the sum of its digits is divisible by 9. Exp: 154368 1+5+4+3+6+8 = 27 27 is divisible by 9, therefor 154368 is also divisible by 9. Your program will compute the sum of the individual digits contained within a user-specified integer and will divide this sum by 9 to determine whether or not the (user-specified) integer is divisible by 9. Your program will call the following 2 UDFS: int get_input(); Prompt the user for an integer and return this integer to main(). Enter an integer: 5463 3 6 4 5 5463 is divisible by 9 void display(int val); Display each digit of the user-specified integer starting with the rightmost digit using the algorithm specified below. Include the following 3 numbers within your test. 154368 621594 123456 Enter an integer: 154367 7 6 3 4 5 1 154367 is not divisible by 9 General algorithm: Use the modulus (%) operator to get each digit. Use / to remove the digit. Exp: 154368 % 10 gives 8 and 154368/10 gives 15436. The next digit extracted should be 6, then 3 and so on

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_2

Step: 3

blur-text-image_step3

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

Students also viewed these Databases questions

Question

1. Explain the 2nd world war. 2. Who is the father of history?

Answered: 1 week ago