Question: Write a recursive function which takes an integer and prints the digit sum. For example, the function will print 45 when the input parameter is

 Write a recursive function which takes an integer and prints the

Write a recursive function which takes an integer and prints the digit sum. For example, the function will print 45 when the input parameter is 123456789 (= 1 + 2 + 3 + + 9 = 45). Do not use any other function in your solution. Include several function calls to test your solution Hint: Generally, you may want to pass an one-digit shorter integer everytime recursivly. The floor division and modulo operators are useful for this problem. You may want to add print0 statements for a debugging purpose only while solving this problem Write a function that takes two positive integers and returns the greatest common divisor (GCD) of the two integers using the Euclid's algorithm. Euclid's algorithm: Starting with two values aa and bb, repeatedly apply the formula: 1. If a

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!