It Notes
Problem solving
Step 1- analysis the problem (Aim)
Step 2- Create solutions for the problems
Step 3- Determine the best solution / Select most suitable solution
Step 4- Develop an algorithm for solution (algorithm- meaning steps or instructions for the
computer to follow)
Step 5- Test Algorithm and validate the solution.
Four ways for a computer to solve- InputProcessOutputStorage
The Algorithm must have certain things
Step 1- Algorithm Must is finite (A Start/Begin and a Stop/Finish)
Precise- Logical Steps
Must have Input (get, read, enter) Output (print)
Types have algorithms
1) Narrative- use English words.
2) Pseudo code-uses English and coding.
3) Flow Chart- Uses symbols and words.
Problem- I want the computer to write an algorithm to input 3 numbers then find sum of three
number then print out answers
Narrative 1) Start-(Ask user for three numbers, store numbers using variables, Calculate the
sum of the number, Output the Sum) Stop.
Pseudo Code- Start (Get num1, num2, num3, Read num1, num2, num3, SUM
Num1+Num2+Num3, Output/Print (Sum), End.
Flow chart- Direction
Input/output
Decision
Start/Stop
Process
Flow Chart-
Symbols- +,-,*, /, MOD, Div
Example: 5/2=2.5 5 Div. 2 = 2 (drops the remainder), 5 MOD 2= 1 (remainder only)
>, < lesser and greater than
>=,<=Greater than or equal too
<>,! Not equal too
= For Assignment e.g.-A=5
== to test a value e.g. if A==5
Constructs
1) Sequence- Step by Step
2) Selection- Step by Step then branch into two directions
3) iteration- Step by Step to loops( types of loops- Finite loop e.g. For (finite loop)
X(counter) =(start) 1 to 10(stop) do(instruction) Print “yes”(infinite Loop x=10 while x>20
Print ‘’yes” x=x+2)
Variable – used to store data, can change, uses words, characters, combinations of
words and characters and cannot begin with a number, names must reflect stored data
Prime_num3=3
Types of variables
Integers- Positive or negative numbers whole number
Real/float – Decimal or Fractional
Character Letter/symbol
String- Word or groups of words
Constant –Doesn’t change