Related to compute f(n) question given in practise section

sir my code is giving a desired output then also shows this

my code