English, asked by ranchodas9967, 1 month ago

) What does h(19685) return for the following function definition?def h(x): (d,n) = (1,0) while d <= x: (d,n) = (d*3,n+1) return(n) ANS: 10 2) What is g(36) - g(35), given the definition of g below?def g(n): s=0 for i in range(2,n): if n%i == 0: s = s+1 return(s) ANS: 5 3) Consider the following function f. def f(n): s=0 for i in range(1,n+1): if n//i == i and n%i == 0: s = 1 return(s%2 == 1) ANS: n is a perfect square. 4) Consider the following function fpp. def foo(m): if m == 0: return(0) else: return(m+foo(m-1)) ANS: The function terminates for non­negative n with f(n) = n(n+1)

Answers

Answered by Mholya
2

Answer:

I hope it is helpful to you

Attachments:
Similar questions