Recursion-Nth Triangle


https://hack.codingblocks.com/contests/c/457/365

Why the output is 4?
i have applied recursion of sum of digits. Is that wrong? Because we are adding digits here. Right?
Please rectify my code.

Hey Preesh, your code was incorrect, you are not supposed to add digits of a number… you are supposed to add all the natural numbers till n. you can do that using loop and recursion both. I have edited your recursive code you can refer this.