Teaching UGC NET Mock Test Series 2025 (Paper 1 & 2) Programming and Data Structure Programming in C Function Recursion
Consider the following C code: .
#include < stdio.h >
int temp = 0;
int fun(int x, int y) {
int z;
temp++;
if (y == 3) return(x * x * x);
else {
z = fun(x, y / 3);
return(z * z * z);
}
}
int main() {
fun(4, 81);
printf("%d", temp);
return 0;
}
What will be the output of the above code ?
1
3
2
4
3
5
4
6