A Picture is Worth 1,500 Words

Daniel felipe Escobar chavez
2 min readJun 17, 2021

--

Hello programmer friends, today explain a topic that is vital in programming which is recursion and to explain it I will use a function that is what we will see here:

float _pow_recursion(float x, float y)
{
if (y == 0)
return (1);
if (y < 0)
return (_pow_recursion(x, y + 1) / x);

return (_pow_recursion(x, y - 1) * x);
}

This program is basically in charge of showing a number x and a number y, and the result is x raised to y, first we check if y is equal to 0 and if so we will return 1 and finish the program since it cannot be raised to 0.
The next step is to verify if y is greater or less than 0, if it is less, what we will do is add the number until we reach 0, the same if it is greater than 0 we will add it and this is to count how many times the number has to be multiplied. number, the end of the number is multiplied until it finishes counting all the times that we did recursio.
Do you think it is difficult? Let’s see it graphically

Well that’s all for now, in conclusion the recursion in the programming helps us reduce the space in code and increases its effectiveness so it is a great tool to be a great developer

Thanks for reading and see you next time!.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet