Introduction to functions, loops, Intro to recursion and time complexity.
Problem given a integer you need to return the sum of digits recursively. Suppose 999 -> 27 -> 9
We will build from scratch, maximum integer is 9...(9) count. So we can always get the single number in maximum of 3 steps, we will try with dirty code and start cleaning and make it reusable and modular.
General trick to count digits is implemented using while loop, but there is a for loop implementation
for (n; n != 0; n = n/10){
r = n % 10;
sum = sum + r;
}