Looping in Java

Loops allow us to repeat the same set of instructions a number of times until a certain pre-specified condition is met. There are different looping statements in Java.

for loop

Output

while loop

Output

do…while loop

Output