What is the output of the code written in C? void main()
What is the output of the code written in C?
void main()
{
int k = 8, v = 8, i;
i = k/++v;
printf("%d/n", i);
}
Show answerHide answer
Correct answer: (A) 0
Explanation
++v makes v = 9 before the division. Then i = 8/9 = 0 because integer division drops the fraction. printf prints 0 (followed by the literal text "/n").