|
|
Repetition and LoopingIf we are expecting a certain condition to be met, how do we ensure that the condition is met before the program proceeds?Testing for the condition, you may need to test for a given condition many times, and thus need a loop. What is a loop? A loop is when a certain portion of a program is repeated until an exit condition is produced and/or met. Why would we want to repeat a certain portion of a program? How is loop implemented in C? There are three types of loops in C. What should be noted when using a loop? A loop consists of three parts: When a loop is used four phases take place. /* Project: Lab5 */ /* File: loop.C */ /* Aim: Looping or Repetition */ /* Keywords: for */ #include
|