CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

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);
}

Open in App
Solution


So output will be printed in serial order given in solution i.e, 3 1 2 2 1 3 4 4 4.

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Fear of the Dark
QUANTITATIVE APTITUDE
Watch in App
Join BYJU'S Learning Program
CrossIcon