I am getting wrong answer


please help me find the error

@be10046.19
You have missed the case when k is 1. Ans should be n in that case. Simply write sum[1]=n; just after line 17