Computer Sciences > Gate 2017 Set-1 > Storage Class
The output of executing the following C program is ________.

# include<stdio.h>
int total(int v)
{
    static int count = 0;
    while (v) {
    count += v & 1;
    v >>= 1;
    }
    return count;
}
void main()
{
    static int x = 0;
    int i = 5;
    for (; i> 0; i--) {
        x = x + total(i);
    }
    printf (โ€œ%dnโ€, x) ;
}

Correct : a

Similar Questions

Match the following: (P)static char var; (i)Sequence of memory locations to store addresses (Q)m=malloc(10);m=NULL;...
#165 MCQ
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...
#1 MCQ
Which number does not belong in the series below? 2, 5, 10, 17, 26, 37, 50, 64
#4 MCQ

Related Topics

No tags found

Unique Visitor Count

Total Unique Visitors

Loading......