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;
}
Show answerHide answer
Correct answer: (A) 6