GATE CS 2017, set 1 · Question 55 · Programming and Data Structures · Numerical answer (NAT) · 2 marks · no negative marks
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(“%d ”, x);
Answer
Answer 23
Answer from the official GATE CS 2017 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes