[RECURSION] IN C

----------------------

RECURSION

----------------------

& WHAT IS RECURSION?

.Function calling itself is called as recursion 

.Recursion is similar to loop

.each time function call itself with slightly simple as compare as orignal version

Working principal   {easy to learn from diagram }


***************

Run screen

***************


$$$$$$$$$$$ 

Source Code

$$$$$$$$$$$

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

// CODE BY [ UB CODES ] //

main()
{
    int k;
    clrscr();
    k=fun(3);
    printf("[ %d ]",k);

    getch();

}

fun(int a)
{
    int s;
    if(a==1)
        return(a);
    s=a+fun(a-1);
    return(s);
}

#########################

ALL RIGHTS GOES TO [UB] CODES

#########################

\-------------------------------------------------------/

Popular posts from this blog

[2D] ARRAY

Switch in C

2D [STRING] IN C