Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2018
Questions

Q21

NAT1 markProgramming

Consider the following C\text{C} program:

#include<stdio.h>
int counter=0;
int calc (int a, int b) {
    int c;
    counter++;
    if(b==3) return (a*a*a);
    else {
        c = calc(a, b/3);
        return (c*c*c);
    }
}
int main() {
    calc(4, 81);
    printf("%d", counter);
}

The output of this program is ______.

Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.