chapter 5 Flashcards
counter-controlled while loop
- “while” loop that is used when you know how many items of data are to be read
- the loop will continue until the condition designated by the counter is met or evaluates to “false”
decision maker
an expression in an “if” statement, which determines whether to execute the statement that follows it
divisor
suppose that M and N are integers and M is nonzero. then M is called a divisor of N if N=MT for some integer T; that is, when M divides N, the remainder is 0
End-of-File (eof) controlled “while” loop
a “while” loop that stops when it reaches “|” at the end of the input file
Fibonacci number
a number in the Fibonacci sequence
Fibonacci sequence
a (sub) n = a (sub) n-1 + a (sub) n-2
flag variable
a Boolean variable used to control the execution of a “while” loop
flag-controlled “while” loop
uses a Boolean variable to control the execution of the loop
“for” loop (indexed loop)
- used to simplify the writing of counter-controlled loops
- consists of an initialization statement, the loop condition, and the update statement
“for” loop control variable
- a loop control variable in a “for” loop
- also called an indexed variable
infinite loop
a loop that continues to execute endlessly
loop control variABLE (LVC)
variable that controls the end of the loop
nesting
process that involves putting one control structure inside another
postest loop
a loop in which the loop condition is evaluated before executing the body of the loop
sentinel
an arbitrary value used to stop the execution of a loop