WHAT WOULD BE PRINTED FROM EACH OF THE FOLLOWING PROGRAM SEG
Solution
The output is
14
18
The explanation is as follows:
while (++j<=16) // j=11
{
j++; //j=12
j=j+1; //j=13
printf(\"%d\ \",++j); //j=14 and prints this value
the program is also executed 2nd time as while condition is true.
while (++j<=16) //j=15
{
j++; //j=16
j=j+1; //j=17
printf(\"%d\ \",++j); //j=18 and it prints this value
when it goes 3rd time to check the while condition then it is false hence it stops execution
}
}
