Download presentation
Presentation is loading. Please wait.
Published byErika Eaton Modified over 9 years ago
3
Three Two One
7
Whenever you attempt to solve a problem, there are certain steps you should follow. 1.Define the problem 2.Propose and evaluate solutions 3.Determine the most efficient solution. 4.Represent the most efficient solution in the form of an algorithm 5.Test and debug the program 6.Document the program (i.e. a written explanation of how the program works and how to use it)
8
How do we fry an egg? Write the steps involved in frying an egg.
9
In defining the problem there must be no ambiguity. The problem should be clear and concise and have only one meaning.
10
In order to write a program to accomplish a certain task you must analyse the task as a sequence of instructions that can be performed by the computer. These instructions can be divided into three main parts: Input and Storage instructions, Processing instructions and Output instructions.
11
Input & StorageProcessingOutput
16
IF a < 10 THEN Read Num ENDIF
18
WHILE m <> 0 DO PRINT y FOR x = 1 to 5 DO r = x * 10
23
Textual DataNumerical DataBoolean Data This may include a combination of letters, symbols, and numbers. These are simply numbers. This is data that must be either true or false. (1) Character(1)Real(1) True Examples: a,b,c,$,^,*,2,9,0 Numbers with a decimal point. Examples: 5.6, -43.7 Examples: The sky is blue – True 10 = 6 + 4 – True (2) String(2) Integer(2) False Davis, Shania, ‘Average’ Numbers without a decimal point. Examples: 5, 18, -20 Examples : The dog can fly - False 10 > 25 – False
24
DATATYPE The Grade a student got in a course, e.g. A,B,C,D,F Character The time Usain Bolt takes to run a 100m race (in seconds) Real The number of books in person’s bagInteger Whether or not a piece of luggage is overweightBoolean The cost of an item in a storeReal A person’s nameString
27
Mariah1541585
29
Program Area; Var Base, Height: Integer; Area: Real; BEGIN Area := (Base * Height) / 2; PRINT “Enter the Base”; READ Base; PRINT “Enter the Height”; READ Height; PRINT Area; END.
31
Arithmetic OperatorOperation +Addition -Subtraction *Multiplication /Division
32
Relational OperatorOperation >Greater than <Less than >=Greater than or equal to <=Less than or equal to <>Not equal to =Equal to
33
Logical OperatorOperation ANDAnd OROr NOTNot
37
Count = 0 While Count < = 10 DO Count = Count + 2 Print Count EndWhile Count = 0 While Count < = 10 DO Count = Count + 2 Print Count EndWhile
38
CountOutput 0 22 44 66 88 10 Count is set as 0; Count < 10. 2 is added to count and 2 is printed. Count < 10. 2 is added to count and 4 is printed. Count < 10. 2 is added to count and 6 is printed. Count < 10. 2 is added to count and 8 is printed. Count < 10. 2 is added to count and 10 is printed. Count <= 10 so the loop is exited.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.