InterviewSolution
Saved Bookmarks
| 1. |
What instruction would I use if I wanted a loop to execute 10 times |
|
Answer» iable used in the LOOP CONDITION is the NUMBER i, which you use to count the integers from 1 to 10. FIRST you initialize this number to 1. In the condition, you check whether i is less than or equal to 10, and if this is true you execute the loop body. Then, at the end of the loop body, you update i by incrementing it by 1.Here is an example of the PROGRAM using a while loop,statement;i = 1 while i <=10:; i += 1This program will execute the "statement" 10 times. |
|