PSEUDOCODE
PSEUDOCODE
Pseudocode
• Declaration & Usage of Variables & Constants
• Variable – Store of data which changes during execution of the program (due to user input)
• Constant – Store of data that remains the same during the execution of the program
EXAMPLE :
INPUT Name
OUTPUT "Hello Mr." , Name
// Alternatively //
READ Name
PRINT "Hello Mr," , Name
• Declaration of variable
- A variable/constant can be declared by the following manner
h level programming language.
d output commands)
// Alternatively //
READ Name
PRINT "Hello Mr," , Name
• Declaration of variable
- A variable/constant can be declared by the following manner
Declaring a variable means introducing it to your program and specifying its name and type.
It's like giving a name to something (the variable) and saying what kind of thing it is (the type
Imagine you have a box (the variable) and you want to label it with a name (the variable nam
and specify what can go inside it (the type).
For example, you might have a box called "age" where you'll put numbers representing som
So, when you declare a variable in your program, you're essentially creating that labeled bo
SOMEONE'S AGE
LITTLE QUIZ :
VARIABLE NAME________________________
• Array:
e).
me)
meone's age.
ox and saying what kind of information it will hold
• DATATYPE OF A VARIABLE :_____________________
• Array:
• Array is similar to variable but it can store multiple values of same datatype under single nam
• EXAMPLE:
DECLARE numbers : ARRAY [1:5] OF INTEGER specifies the range or size of the a
The "Lower Limit" and "Upper Lim
represent the boundaries of the a
ARRAY NAME
This is where you specify INDICATES WHAT FOLLOWS AN ARRAY
the name of the array
you're declaring.
For instance, if you have an array of numbers like [10, 20, 30, 40, 50], LETS SAY THESE
the index values and corresponding elements would be:
• Index 0: Element 10
• Index 1: Element 20
• Index 2: Element 30
• Index 3: Element 40
• Index 4: Element 50
THINGS TO CONSIDER:
• All keywords are written in capital letters
me
array.
mit"
array indices.
E ARE TEMPERATURES
• Index 3: Element 40
• Index 4: Element 50
THINGS TO CONSIDER:
• All keywords are written in capital letters
• Whenever conditional and loop statements are used , repeated or selected statements a
- IF…THEN…ELSE…ENDIF CONDITION =
CONSEQUENCE=
THE ENDING OF
STATEMENT
IF THEN ELSE
END : ENDIF
Tip to identi
A CONSEQU
QUESTIONS :
A) WRITE A PROGRAM THAT ONLY ACCEPTS CHILDREN ABOVE 18 TO RIDE AND DECLIN
BELOW 18
CONDITION :
CONSEQUENCE :
METHOD:
are indented by two spaces
ASSOCIATION: OUTPUT
-------> DISPLAYS
F ANY CONDITIONAL
CONDITION :
CONSEQUENCE :
METHOD:
IF AGE>18 THEN
OUTPUT " CAN RIDE"
ELSE
OUTPUT" CANNOT RIDE"
ENDIF
ULTIPLE CONDITIONS
SEQUENCES