Power of number (recursion)

ques : https://practice.geeksforgeeks.org/problems/power-of-numbers/0

code : https://ide.codingblocks.com/s/221648

answer is correct… showing segmentation fault
what is the error?

Hello @chaman9,

You are getting segmentation fault due to excessive recursive call which is leading to overflowing of call stack.

Solution:
Write an iterative function.

Refer to this link: https://www.geeksforgeeks.org/write-an-iterative-olog-y-function-for-powx-y/

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

okay thanks… i will try this out