Algorithm A algorithm is a stepDesign by step instruction that must have a set of rules that must have a explicit STOP POINT! Pseudo code is colloquial English-like terms used to specify a task A pseudocode should begin with the keyword PROGRAM and end it the keyword END. IPO chart algorithm read three numbers number3
Pseudocode READ number1, number2,
add three numbers together
total = number1,
• Related line of code form a statement. • Instructions within the statement are called keywords. • Variables: these store data for the program to work within. local, global, or constant. • Conditional statement: provide a choice of “if /then/else”
• Loops allow parts of a program to be repeated. Example “ do/while” “for /next”, or “repeat/until”. A statement is a description of an action or condition. Keywords such as READ, WRITE, DO, WHILE, FOR, NEXT, PRINT
Conditional statements allow decision in a program to be made. IF/ THEN: IF ( some condition is true) THEN Example: READ number1, number2, number3 total = number1, number2, number3 IF total > 50 THEN If PRINT total ( mon ey>1 True 49) IF (condition) Buy Soda
THEN statement END IF
One Option False
IF/ THEN/ ELSE: IF/ THEN: IF ( some condition is true) THEN ELSE (otherwise) Example: