Computer Applications

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);

Java Iterative Stmts

10 Likes

Answer

int a = 10, b = 1;
do {
    b += a;
    b++;
    a -= 2;
} while(a >= 1);
System.out.print(b);

Answered By

6 Likes


Related Questions