Prg 420 Week 3 Supporting Activity 1 loops
in Computers by vommsYour Price: $6.99 (30% discount)
You Save: $3.00
Description
Prg 420 Week 3 Supporting Activity 1
There are 3 kinds of loops-forloop, whileloop, and dowhile loop. Under which circumstances would each kind of loop be more appropriate? Explain your answers using specific examples.
For loop- The for loop is best used when the number of iterations is known. The for loop is best used to repeat the loop a fixed number of times. The Boolean-expression is tested at the beginning of the loop. The for loop has the form: for (initialization; Boolean-expression; increment) {nested statements }.
A for loop can be used to show every number divisible by 3 between 1 and 60.
For (int num0; num , 60; num) {
If (num % 3 0) {
( "#: " dex);
}
}
While loop- While loops are best used when the exiting condition has nothing to do with the...