The function f(n) given above returns True for a positive number n if and only if:
Answers
Answered by
0
Answer:
True for a positive number n if and only if
where n is a perfect square.
Explanation:
When n=1, the value of s will be 1 and return
false
When n = 2, the value of s will be 2 and
returns true
When n=3, the value of s will be 2 and
returns false
When n =4, the value of s will be 3 and
returns true
When n = 5, the value of s will be 4 and
returns false
When n 6, the value of s will be 4 and
returns false
When n =7, the value of s will be 2 and
returns false
When n=9, the value of s will be 3 and
returns true
When n-16 the value of s will be 3 and returns
true
From the above values we can state that
whenever the value is a perfect square, the
function returns true.
Similar questions