GATE Computer Science (CS) 2021 Shift 2 Solved Paper
© examsiri.com
Question : 59 of 65
Marks:
+1,
-0
Consider the following ANSI C program
The output of the program upon execution is ________
#include <stdio.h>
int foo(int x, int y, int q)
{
if ((x <= 0 && (y <= 0))
return q;
if (x <= 0)
return foo(x, y - q, q);
if (y <= 0)
return foo(x - q, y, q);
return foo (x, y - q, q) + foo(x - q, y, q);
}
int main()
(
int r = foo(15, 15, 10);
printf("%d", r);
return 0;
}The output of the program upon execution is ________
- Your Answer:
Go to Question: