lib/sum.js
// program to find the sum of natural numbers using recursion
program to find the sum of natural numbers using recursion
program to find the sum of natural numbers using recursion
function sum(num) {
    if(num > 0) {
        return num + sum(num - 1);
    }
    else {
        return num;
    }
 }
function sum ( num ) { if ( num > 0 ) { return num + sum ( num - 1 ) ; } else { return num ; } }
program to find the sum of natural numbers using recursion
program to find the sum of natural numbers using recursion