The output of executing the following C program is ________.
c
Programming in CFunctions, Parameter Passing, Scope Rules, RecursionNAT2 marksMedium
1#include <stdio.h>
2int total (int v) {
3 static int count = 0;
4 while (v) {
5 count += v & 1;
6 v >>= 1;
7 }
8 return count;
9}
10void main ( ) {
11 static int x = 0;
12 int i = 5;
13 for (; i > 0; i--) {
14 x = x + total (i);
15 }
16 printf ("%d\n", x);
17}
18A GATE question every morning
One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.