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

 ubuntu programming Example output: An integer is divisible by 9 if

ubuntu 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. Enter an integer: 154367 7 6 3 Include the following 3 numbers within your test. 154368 621594 123456 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

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!