GATE Computer Science (CS) 2016 Shift 1 Solved Paper
© examsiri.com
Question : 45 of 65
Marks:
+1,
-0
What will be the output of the following C program?
void count (int n) {
static int d=1;
printf("%d ", n);
printf("%d ", d);
d++;
if(n>1) count (n-1);
printf("%d ", d);
}
void main() {
count(3);
}
void count (int n) {
static int d=1;
printf("%d ", n);
printf("%d ", d);
d++;
if(n>1) count (n-1);
printf("%d ", d);
}
void main() {
count(3);
}
Go to Question: