Question: c++ problem Write a recursive method int mul(int a, int b) that computes the product of two nonnegative integers a and b. You are not
Write a recursive method int mul(int a, int b) that computes the product of two nonnegative integers a and b. You are not allowed to use multiplication () Hint: use addition (+) and recursion. Write a method evenDigits that accepts an integer parameter n and that returns the integer formed by removing the odd digits from n. The following table shows several calls and their expected return values: 1- 2- Call Valued Returned evenDigits (8342116); 8426 evenDigits(4109); 4 evenDigits (8); evenDigits (-34512) 42 evenDigits(-163505)60 evenDigits (3052); 2 evenDigits(7010496) 46 evenDigits(35179); evenDigits (5307); evenDigits(7) If a negative number with even digits other than O is passed to the method, the result should also be negative, as shown above when -34512 is passed. Leading zeros in the result should be ignored and if there are no even digits other than O in the number, the method should return O, as shown in the last three outputs
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
