[ create a new paste ] login | about

Link: http://codepad.org/xqkyhdxA    [ raw code | output | fork ]

C, pasted on Jun 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>
int main (void)
{
    int y = f(5);
    printf("Y is: %d", y);
    return 0;
}

int f(int x)
{
    if(x <= 0)
        return 0;
    else
        return f(x-1) + 2;
}


Output:
1
Y is: 10


Create a new paste based on this one


Comments: