Create a free account on Computer Sir Ki Class and unlock access to valuable learning resources.
Exam Paper Downloads: After registering and logging in, you can download exam question papers in PDF format to practice and prepare for your exams.
Student Support: Get assistance with your doubts, queries, and questions related to your studies. Our support is here to help you understand topics and resolve your learning difficulties.
Register today and make your exam preparation easier and more effective!
Give the output of the following program segment and also mention how manyΒ times the loop is executed:
int i;
for (i=5;i>10;i++)
System.out.println(i);
System.out.println(i*4);
Answer:
The output will be 20.
The loop will not be executed as i has been set to 5 and its >10 is being checked so it will come out without any execution.
So only last statement of the program will run and will produce 5*4 as output which would be 20.
C. Sir| Created: 25-Mar-2018 | Updated: 22-Mar-2026|ICSE2018