Given a number N, your task is to print all even numbers (>0) from 1 to N using recursion.
Input : N = 7 Output : 2 4 6
Check if the value of N is even, recursively go on checking for other values of N-2 and print this value by referring some online coding classes.
If the value of N is odd, recursively go on checking for (N-1) as (N-1) would be even.
If at any point, N becomes (<=0), simply return.
if (n <= 0) exit if (n is even) check for (n-2) and print n if (n is odd) check for (n-1)
STATE SPACE TREE: