Question



Repetition Loops Chapter 6 - Due Intro to Java Programming Section 141 Summer 2019 CO Compare the various loop structures wit
0 0
Add a comment Improve this question Transcribed image text
Answer #1

there are mainly 3 types of loops are present in java.

java loops:

1.while loop:

if we don't know how many times exactly the loop need to be executed then we are going to use while loop.

it means while loop executes the block of code until the given condition in loop get false.

Syntax:

while(condition )

{

executes this block of code;

}

2.Do while loop:

this works as it as like as the while loop but it executes the block of code inside the loop atleast once.

Syntax:

do

{

executes the block of code;

}while(condition )

3.for loop:

this loop is used when we know how many times exactly the code inside the loop need to be executed.

Syntax:

for( initialization ; condition ; increment)

{

block of code;

}int i=1; while(i<1) { System.out.println(i); 3 i++; 9 output No output because the condition(1<1) fails. 11 12 13 int i=1; do

Add a comment
Know the answer?
Add Answer to:
Repetition Loops Chapter 6 - Due Intro to Java Programming Section 141 Summer 2019 CO Compare...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT