Func1int n if n 0 return True else return func2nl func2Cint


Func1(int n) {if (n == 0) return True; else return func2(n-l) func2Cint n): if (n == 0) return False; else return func1(n-l) func2(4) fund (4) What numeric property do these functions test for?

Solution

a) func2(4)
   this function call will result in false by recursively calling func2(4)->func1(3)->func2(2)->func1(1)->func2(0)
b)func1(4)
this function call will result in true value by recursively calling func1(4)->func2(3)->func1(2)->func2(1)->func1(0)

c) func1- tests whether the number is even or not
func2-tests whether the given number is odd or not

for further queries kindly get back

 Func1(int n) {if (n == 0) return True; else return func2(n-l) func2Cint n): if (n == 0) return False; else return func1(n-l) func2(4) fund (4) What numeric pro

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site