Question: int modulus ( number , base ) The modulus operation returns the unit value of a number in a given base. For example: In base
int modulus number base The modulus operation returns the unit value of a number in a given base. For example: In base the unit value of is In base the unit value of is In base the unit value of is Write a recursive function in that will calculate the modulus of two positive inputs the number and the base Note: you may only use addition and subtraction you must not use multiplication, division, modulus, or any other methods in your solution, and you will not receive any credit for a nonrecursive solution. Hint: use repeated subtraction. For example, the following statements would lead to the underlined output: Example :
print modulus ;;
Example :
print modulus;;
Example :
print modulus ;;
Note: you may assume two positive inputs no error checking of inputs is required.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
