What will be the output of the following C code?
#include <stdio.h>
void main()
{
int i = 0;
while (i < 10)
{
i++;
printf("hi\n");
while (i < 8)
{
i++;
printf("hello\n");
}
}
}
#include <stdio.h>
void main()
{
int i = 0;
while (i < 10)
{
i++;
printf("hi\n");
while (i < 8)
{
i++;
printf("hello\n");
}
}
}A. Hi is printed 8 times, hello 7 times and then hi 2 times
B. Hi is printed 10 times, hello 7 times
C. Hi is printed once, hello 7 times
D. Hi is printed once, hello 7 times and then hi 2 times
Answer: Option D

Join The Discussion