I am getting segmentation fault

question-simple enough
My code-https://ide.codingblocks.com/s/241263

@vaibhav5147
I see you’ve resolved the issue so I’m closing this doubt

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Sir, Can you explain the error in my code https://ide.codingblocks.com/s/241263

@vaibhav5147
Sure buddy
Looking into it

Hey @vaibhav5147
On the whole the logic is correct
Must be some small issue in implementation somewhere
How did you get 100 then though ?

In my first code ,I try to break the code at each case . I got segmentation fault. Then, I write recursion code .

I ask doubt because I always stuck in Segmentation fault error.

@vaibhav5147
Please verify your approach with this then