Simple While Loop
This is a simple example, on the execution and purpose of while loops.
Download files: SimpleWhileLoop.java
Areas: Introduction to loops.
|
|
SimpleWhileLoop.java |
|
View full source |
| Question 1 |
| When does the while loop terminate? int a; |
| Question 2 |
| What is the output of the code? |
| Question 3 |
| How many times is the while loop executed? |
| Question 4 |
| How many times is the condition m>n checked? |
| Question 5 |
| What are the values of m and n, when the while loop finishes? |
