Different answer for both approches

For n=100 top down is giving ans = 7 while bottom up is giving 6 as answer.
Please check which one is wrong

got it, n was to be replaced by i XD