What will be the output of the following C program segment? #include <stdio.h>…
BEL Probationary Engineer 2025
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;
}- A.
10
- B.
6
- C.
4
- D.
8
Attempted by 125 students.
Sign up free to check your answer
Sign up freeLoading lesson…

