Computer Science, asked by moduguri, 1 month ago

what is f(90)-f(89), given the definition of f below?
def f(n):
s=0
for i in range(2,n):
if n%i==0 and i%2==1:
s=s+1
return (s)​

Answers

Answered by dasc99477
3

Answer:

1) 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)

Similar questions