Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



What is the output for the program given below?
#include <stdio.h>
void main()
{
    int i = 5;
    for (; i < 12; i++);
    printf("%d", i);
}





Solution

The semicolon ; after the for loop makes it an empty loop. The loop increments i until $i = 12$. After the loop ends, printf prints the final value of i.


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...