Question 54Asked in BEL PE Computer Science, 20 Dec 2025 (5:00 PM)

What will be the output of the following C program segment? int main() {

What will be the output of the following C program segment? #include <stdio.h> int main() { int i = 1, sum = 0; do { if (i % 2 == 0) sum += i; i++; } while (i <= 5); printf("%d", sum); return 0; }
  1. A6
  2. B4
  3. C10
  4. D8
Show answerHide answer

Correct answer: (A) 6

From BEL PE Computer Science PYQ, 20 Dec 2025 (5:00 PM)

This is question 54 of BEL PE Computer Science PYQ, 20 Dec 2025 (5:00 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.