Programming-for-Output-Problems
September 29, 2023Programming-for-Output-Problems
September 30, 2023Programming
Question 1 |
Consider the following 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 ______.
#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 ______.
4 | |
5 | |
6 | |
7 |
Question 1 Explanation:
Correct Answer: A
Question 1 Explanation:
Subscribe
Login
0 Comments