Posts

Showing posts from July, 2022

Calculate the Nth term - Hacker Rank Solution .

Image
  Objective This challenge will help you learn the concept of recursion. A function that calls itself is known as a recursive function. The C programming language supports recursion. But while using recursion, one needs to be careful to define an exit condition from the function, otherwise it will go into an infinite loop. To prevent infinite recursion,  statement (or similar approach) can be used where one branch makes the recursive call and other doesn't. void recurse() {     .....     recurse()  //recursive call     ..... } int main() {     .....     recurse(); //function call     ..... }