/* standard library includes */ #include /* the function prototype */ int f(int, int); /* the main function with the default arguments */ int main(int argc, char **argv) { /* declare x, y and result to save the numbers */ int x, y, result; /* ask for the numbers */ printf("Enter number for x and y separated by a space:\n"); scanf("%d %d", &x, &y); /* calculate the result */ result = f(x, y); /* print the result */ printf("The result is: %d\n", result); /* exit the program */ return 0; } /* the function body */ int f(int x, int y) { /* return if x<0 or y<0 */ if(x<0 || y<0) { return x-y; } /* else recurse until we get x or y < 0 */ else { return f(x-1, y) + f(x, y-1); } }