Sunday, March 31, 2013

C Language Example # 47 Recursive Function Call Example # 01

C Language Example #  47 Recursive Function Call Example # 01.

* This program is example of recursive call of function.
* Program calls function named series. then this function call itself.

//Written by : Latest Technology Guide
//Title : C Language Example #   47 Recursive Function Call Example # 01.

 
#include <stdio.h>
#include <conio.h>

void main()
{
    clrscr();
    int n;

    void series(int,int);

    printf("How Many Elements are there :  ");
    scanf("%d",&n);

    series(1,n);

    getch();
}
void series(int start,int n)
{
    if(start>n)
        return;
    else
    {
        printf("%3d",start);
    }
    series(start+1,n);
}
Output:




--------------------------------------------------------------------------------
Explanation of C Programming Language Example #  47 Recursive Function Call Example # 01.

*  Program will call function itself (recursive call) to display series.


Note: All programs are developed and tested using Turbo C++ 3.0 under Windows XP. We just want to provide guidelines to the users. If you are using any other Compiler or other operating system they you need to modify this program as per your requirements.

1 comment:

  1. thank you for sharing nice article in your blog
    visit
    web tutorial programming
    https://www.welookups.com

    ReplyDelete