3.3-3.4 Hacks
algorithms, sequences, selection, iteration
Hack 1
Sequencing:
- set item to number to search for
- get next number in the list
- if number = item, display "item found"
- if there are more numbers in the list, go back to step 2
- display "item not found" Selection:
- if number = item, display "item found" Iteration:
- if there are more numbers in the list, go back to step 2
Hack 2
num1 = 5 num2 = num1 3 num3 = num2 / num1 (9 % 2) 4 result = (num3 % num1 + num2) % num3 3 / 5
- 5
- 5*3= 15
- 15/5=3 1=34=12
- 12/5 +15=17 % 12 = 5*3 = 15/5 = 3
Crossword
1 down - iteration 2 down - selection 3 across - sequence