Computer Sciences > Gate 2018 > Function
Consider the following C program:
The output of this program is ________ .
#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);
}
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 ________ .
Correct : a
Similar Questions
Consider the following C functions.
int tob (int b, int* arr) {
int i;
for (i = 0; b>0; i++) {
if (b%2)
&nbs...
Consider the following C functions.
int fun1(int n)
{
static int i= 0;
if (n > 0) {
++i;
...
A palindrome is a word that reads the same forwards and backwards. In a game
of words, a player has the following two plates painted with letters.
From...
Total Unique Visitors
Loading......