Writing Algorithms Style 2

There are no strict rules about writing pseudocode; the style below is similar to the pseudocode from the exam papers.

1) Read the question fully a number of times – don’t just assume you know straight away what is being asked

2) Identify the different programming elements that you will need

  • Identify Inputs (including variable Types)
  • Do you need an array?
  • Identify Calculations (Do you need additional variables?)
  • Identify Conditions (if x > 7)
  • Identify Loops (For i = 1 to 7 or repeat until x > 5)
  • Identify Outputs (including variable Types)

3) Begin to write your code 

You should use the type of pseudocode below to make it easier to the examiner to give you marks. (There are no real rules about pseudocode, but let’s not confuse the examiner)

Add outputs and inputs:

    Output “Please enter name”
    Input Name
    Output “Score is”, score

Add loops:

    For i = 1 to 5
         
    While x > 0

Add calculations or conditions:

     If x > 10
         Output “You win”
     x = x + 5

Double check what goes before the loop, in the loop and after the loop.

Try these ones yourself.

Advertisement
%d bloggers like this: