Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
5.1k views
in Information Technology by (71.3k points)

Observe the given code:

int ctr=10;

while(ctr>5)

{

ctr=ctr-2;

}

Attempt the following questions based on the above given code:

(i) How many times the above given loop will run and what will be the value of ctr, immediately after exiting from the loop.

(ii) Out of entry controlled or exit controlled loop, above given loop will come under which category and why?

1 Answer

0 votes
by (76.5k points)
selected by
 
Best answer

(i) 3 times

4

(ii) Above given loop will come under Entry controlled loop as in the above given loop condition is being checked at the time of entering in the loop.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...