Check the logic

I haved written the code and it is compiling . Want to know if my logic is correct or not

following is my code link

Hello @S18LP0146,

There is missing base condition. Rest is correct.
I have corrected your code:

Hope, this would help.
Give a like if you are satisfied.

Sir is it necessary to include n==4 as a base case , because even if i don’t the recursive call gives correct answer.

Hello @S18LP0146,

It may give correct answer as n==4 will be handled by recursive calls.
But to reduce the number of recursive calls. you can do that.