CS202
CS202
GUARANTEED QUESTIONS
Join VU STUDY SOLUTIONS for more request-based assignments and
GDB and files for free. ( سبِی ِل ہللا
َ ) فی
https://chat.whatsapp.com/LAIMHwPEHpTB1jv3cFJzQw
Question No: 1 (3 marks)
While loop and do while loop comparison
ANS:
In a while loop, the condition is checked before the loop body executes. If the condition is false initially,
the loop body may never execute.
while (condition) {
}
In a do-while loop, the condition is checked after the loop body executes. This guarantees that the loop
body executes at least once, even if the condition is false initially.
do {
}
while (condition);
Write output of
For(int i=11; i<20; i+=2)
{
// loop body
}
ANS:
Output
11
13
15
17
19