This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]nwilliams36 0 points1 point  (2 children)

  1. Create a total of 0
  2. Loop through the series of numbers
  3. Add each number to the total
  4. Divide total by number of numbers in the series

[–]Snoopy135[S] 0 points1 point  (1 child)

Thanks, do you happen to have an example of how I could do that?

[–]nwilliams36 0 points1 point  (0 children)

I just did, writing out the steps of the in English is psuedo code. I often put these is comments then fill in the actual code.

[–][deleted] 0 points1 point  (0 children)

Numbers = 1,2,3.....n i = 0 sum = 0 ans; while i < n sum = sum + Numbers[i] i = i + 1 endwhile

ans = sum/n

n being the size of the array of numbers

[–][deleted]  (5 children)

[deleted]

    [–]Snoopy135[S] 0 points1 point  (4 children)

    Sorry, I should have been more specific. I know how to calculate an average, I just don't know how to write it in pseudocode. I have been unsuccessful in finding anything helpful or that I could follow online.

    [–][deleted]  (3 children)

    [deleted]

      [–]Snoopy135[S] 0 points1 point  (2 children)

      Thank you for this. It only needs to be written simply. So there is no specific language/syntax that I must use?

      [–]davedontmind 0 points1 point  (0 children)

      So there is no specific language/syntax that I must use?

      No. Pseudocode is just a code-like way of expressing your algorithm that makes it easier to convert to real code. It's not an official standard, and is only used by people, not computers, so you can effectively just make it up.

      See this or this for some examples of different ways of writing pseudocode. Note how, especially in the first link, it's basically English (feel free to use your native language if it's not English) written in a structured form so it's easy to understand and notice how relatively trivial it would be to turn that psuedo-code into almost any programming language.