0% found this document useful (0 votes)
17 views3 pages

Guide To Creating A Pseudocode

Uploaded by

danahshiwgobin22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

Guide To Creating A Pseudocode

Uploaded by

danahshiwgobin22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Structure of a Pseudocode

Pseudocode: add_three_numbers (the title indicates the start of the pseudocode)

Pseudocode: simple/descriptive title

Declaring_Variable / variable_declaration (making known the variable by stating the name of the
variable and data type of the variable)

Number1 = integer; (variable_name = data_type)

Number2 = integer;

Number3 = integer;

Or Number1, Number2, Number3 = integer;

Total = real;

Phrase = string;

Grade = character;

VAT = real

Initializing_variable / variable_initialization (giving a variable a starting value)

Number1 = 0; (variable_name = value)

Number2 = 0;

Number3 = 0; (note: initializing a variable is also creating a constant)

Or Number1, Number2, Number3, Total = 0;

Total = 0;

Phrase = “Thank you for coming. Have a good day.”;

Grade = “A”;

VAT = 0.14 (note: always convert percentages to decimal)

Garbage value – random value e.g 35465768

Body (IPO)

Input

step 1a: OUTPUT/DISPLAY/PRINT/WRITE “Please enter the 1st Number”; (prompting/requesting


data)

INPUT/READ Number1;
Step1b: put on the screen “please enter the 1st number”

Accept the user input and store it in the variable number1

step 2: OUTPUT “Please enter the 2nd Number”;

INPUT Number2;

step 3: OUTPUT “Please enter the 3rd Number”;

INPUT Number3;

processing

step 4: total = Number1 + Number2 + Number3;

output

step 5a: OUTPUT total; 70

step 5b: OUTPUT “the total is: “, total; the total is: 70

step 5c: OUTPUT “the total is: , total”; the total is: , total

End (indicates the end of the pseudocode)

Example of conditional statement

Entering 40 different maths grade

Step 1 Count = 1

Step 2 While the variable count (40) is less than 40, stay inside of the loop

Step 3 Maths_grade = 40%

Step 4 IF Maths_grade >= 50% (True? Or False?)

THEN Print “You passed” (True)

ELSE Print “You failed” (False)

Step 5 Add one to count = 1 + 39

Count = 40
Step 6 end

You might also like