Rewrite the following program segment using a for loop.

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

2(i)1 Mark · 2026 · Section A · 2026 Paper

Rewrite the following program segment using a for loop.

int a = 5, b = 10;
while (b > 0)
{ b -= 2;
}
System.out.println(a * b);
Show SolutionHide Solution↓
int a = 5, b = 10;
for( ; b > 0; b -= 2)
{
}
System.out.println(a * b);
← Previous questionNext question →

Browse the free Computer Applications sample bank