0

Consider the following functionÂ fdef f(m): if m == 0: return(1) else: return(m*f(m-1)) Which of the following is correct? Â

a)Â The function always terminates with f(n) = n b)Â The function always terminates with f(n) = factorial of n c)Â The function terminates for non-negative n with f(n) = n d)Â The function terminates for non-negative n with f(n) = factorial of n

7th Feb 2018, 2:45 AM
kamalesh vra
+ 2
It's a typical recursive function to compute factorials, but it doesn't take care of negative values. The answer would be d.
7th Feb 2018, 2:49 AM
Hatsy Rei
+ 4
Consider the following function f def f(m): if m == 0: return(1) else: return(m*f(m-1)) Which of the following is correct? The function always terminates with f(n) = n The function always terminates with f(n) = factorial of n The function terminates for non-negative n with f(n) = n The function terminates for non-negative n with f(n) = factorial of n tell a correct answer???
9th Feb 2018, 10:53 AM
S.Iswariya lakshmi
0
f(n)=factorial of n
9th Feb 2018, 10:58 AM
kamalesh vra
0
ans is d
8th Aug 2018, 9:28 AM
Sakthi Subash
0
Consider the following function f. def f(m): if m == 0: return(0) else: return(m+f(m-1)) Which of the following is correct? The function always terminates with f(n) = n(n+1)/2 The function always terminates with f(n) = factorial of n The function terminates for non-negative n with f(n) = n(n+1)/2 The function terminates for non-negative n with f(n) = factorial of n Please tell me this program answer
16th Aug 2018, 4:36 AM
0
Consider the following function h. def h(n): f = 0 for i in range(1,n+1): if n%i == 0: f = f + 1 return(f%2 == 1) The function h(n) given above returns True for a positive number n whenever: n is a multiple of 2 n is a composite number n is a prime number n is a perfect square Tell me the above program answer
16th Aug 2018, 4:38 AM