Wednesday, 18 April 2012

How to implement Recursion algorithm using C programming language

//Green line and line having double back slash are comments
//* function within function Logic is one of the beneficial example for    recursion*/

#include stdio.h >     //preprocessor directive contain all predefine function                                   //codes

    main(void)    // Main start here
      {
          int index;
     
         index = 8;
      
         CountindexDown(index);//function call

      }  //Main Ends here



     CountindexDown( int count)  //Definition of function

        {
             count--;
                printf("The value of the count is %d\n",count);
             
             if (count > 0)
               CountDown(count);
            printf("Current value of count is %d\n",count);
        }

/*To verify the result or output paste the code in  codepad area and compile or run this*/

No comments:

Post a Comment

Compiler for C,C++ and Python {paste your programme to see the output}