lesson flow charts 2

Post on 12-Apr-2017

44 Views

Category:

Education

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

L.O: STUDENTS WILL LEARN TO READ AND CREATE ALGORITHM

FLOWCHARTS.

There are no set rules for writing pseudocode, but you will often see the following:

• INPUT – indicates a user will be inputting something• OUTPUT – indicates that an output will appear on the screen• WHILE – a loop (iteration that has a condition at the

beginning)• FOR – a counting loop (iteration)• REPEAT – UNTIL – a loop (iteration) that has a condition at

the end• IF – THEN – ELSE – a decision (selection) in which a choice is

made• any instructions that occur inside a selection or iteration are

usually indented

A flowchart is a type a diagram that uses shapes and arrows to represent an algorithm.

Algorithms can be expressed in natural language or in pseudocode, text that describes the steps a program might carry out. These

languages for human understanding may help write the algorithm in a programming language.

Pseudocode:

Input: An integer Limit Ouput: Two integers: Number and Sum

1. Enter Limit 2. Set Number = 0. 3. Set Sum = 0. 4. Repeat the following: a. If Sum > Limit, terminate the repitition, otherwise. b. Increment Number by one. c. Add Number to Sum and set equal to Sum. 5. Print Number and Sum.

top related