Skip to content

Instantly share code, notes, and snippets.

@alunduil
Created October 4, 2020 16:04
Show Gist options
  • Save alunduil/137806e0373e5b291e89b9ab26f7463a to your computer and use it in GitHub Desktop.
Save alunduil/137806e0373e5b291e89b9ab26f7463a to your computer and use it in GitHub Desktop.
Psuedocode Example

Problem Statement

Write psuedocode for the following program output.

Enter number of inputs:7
Enter inputs: 10 2 10 5 1 1 100
10, Occurence:2
1, Occurence:2

Psuedocode

  1. Print "Enter number of inputs:"
  2. Read number of inputs as integer
  3. Print "Enter inputs:"
  4. Read into inputs a string of space separated numbers.
  5. Split inputs into a list of numbers cast to integers.
  6. Print "10, Occurences:"
  7. For all n in inputs count the number of occurences of 10
  8. Print the result of the count
  9. Print "1, Occurences:"
  10. For all n in inputs count the number of occurences of 1
  11. Print the result of the count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment