Question: Programming in C Question 27 (Programming) Consider the process in which we take a number and then sum its digits. Then we repeat this process

Programming in C  Programming in C Question 27 (Programming) Consider the process in which

Question 27 (Programming) Consider the process in which we take a number and then sum its digits. Then we repeat this process until the remaining number has only one digit. This digit is called the digital root of the number For example, starting from the number 9876, we get 30 and then 3. The digital sum of 9876 is 3. The number of times we have to repeat the process before finding the digital root is called the additive persistence of the number. The additive persistence of 9876 is 2. 1) Write a function that uses the method described above to find the digital root and the additive persistence of a given number, n. You function should return the digital root as its result and also set a second parameter to the value of the additive persistence, Your definition should have the prototype: int digital_root (int, int 2) Write a program that prints a table of digital roots of the numbers between I and 1000 (Aside: After looking at this table we can see that the digital root can be computed without performing any iterations using the formula below. You should not use this formula in part (1) but you should solve the problem by actually summing the digits In any case, this does not give the additive persistence Just for interest, the formula for digital roots is: root(n)mod 9), n not divisible by 9 9,n 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!