Convert the given loop into exit-controlled loop.

ICSE Class 10 Computer Applications PYQ · 2025 Paper · Section A

2(iv)1 Mark · 2025 · Section A · 2025 Paper

Convert the given loop into exit-controlled loop.

int a, b;
for(a = 10, b = 1; a >= 1; a -= 2){
b += a;
b++;
}
System.out.print(b);
Show SolutionHide Solution↓
int a = 10, b = 1;
do {
    b += a;
    b++;
    a -= 2;
} while(a >= 1);
System.out.print(b);
← Previous questionNext question →

Browse the free Computer Applications sample bank