Open In App
Related Articles

GATE | GATE CS 2018 | Question 14

Improve Article
Save Article
Like Article

Consider the following C program:

#include <stdio.h>
int counter = 0;
int calc(int a, int b) {
  int c;
  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 ________ .

Note – This was Numerical Type question.
(A) 5
(B) 4
(C) 3
(D) None of these

Answer: (B)

Explanation: 1

Quiz of this Question

Level Up Your GATE Prep!
Embark on a transformative journey towards GATE success by choosing Data Science & AI as your second paper choice with our specialized course. If you find yourself lost in the vast landscape of the GATE syllabus, our program is the compass you need.

Last Updated : 12 Aug, 2021
Like Article
Save Article
Similar Reads