70 likes | 247 Views
- Meeting 7 – Looping. By: Felix Valentin, MBA. Today Topic:. Understand the advantages of looping Looping Partice. Understand the advantages of looping. You can use a variable sentinel value to control a loop
E N D
- Meeting 7 –Looping By: Felix Valentin, MBA
Today Topic: • Understand the advantages of looping • Looping Partice
Understand the advantages of looping • You can use a variable sentinel value to control a loop • Sometimes it is convenient to reduce or decrement a loop control variable on every cycle through a loop • The two mistakes programmers make most often with loops are: • Neglecting to initialize the loop control variable • Neglecting to alter the loop control variable
Understand the advantages of looping • All structured loops share these characteristics: • The loop controlling question provides either entry to or exit from the repeating structure • The loop controlling question provides the only entry to or exit from the repeating structure • When you must use loops within loops, you use nesting loops
Looping Partice • Create a psecudo code for this application: n = 5 <- User Input -0- -00- -000- -0000- -00000-
Looping Partice • Create a psecudo code for this application: n = 5 <- User Input Odd/Even = O <- User Input 2 4 6 8 10 n = 8 <- User Input Odd/Even = E <- User Input 1 3 5 7 9 11 13 15
Looping Partice • Create a psecudo code for this application: