Computer Science, asked by eduguyDEBA, 8 months ago

»
Rewrite the following loop using for loop:(java)
while (true)
System.out.print("*");​

Answers

Answered by NandanChopra
0

Answer:

U have written the answer

Answered by priyaag2102
0

The loop given to us is a while loop i.e. it will run infinitely many times and will never stop because there is no condition in the while statement. Whereas the statement will always return true irrespective of any condition and will keep printing the '*' character.

Explanation:

The loop given to us is a while loop i.e. it will run infinitely many times and will never stop because there is no condition in the while statement. Whereas the statement will always return true irrespective of any condition and will keep printing the '*' character.

The given loop can be rewritten using a for loop:-

for(i=1;i>0;i++)

{

system.out.print("*");

}

Similar questions