Hello, World!
Pseudocode
Website with examples
https://github.com/digshake/wustl-helloworld
What is pseudocode?
First:
What is code?
What is a programming language?
Variables
Variables are used to tell stories
Let me tell you a story using variables!
Exercise
Tell the following story using variables:
Michael is 30 years old
Sally is twice Michael's age
Sally is 3/4ths as old as Bill
Rachel is 52 years younger than Bill
The average age of the group is.?
Choice
Exercise
You are given two variables, x and y
Write code that ensures that x will always be
larger than y, swapping them if necessary
Iteration
Exercise
Write code (using loops!) that prints:
The values from 0 to 10 (inclusive)
The values from 1 to 10 (inclusive)
The values from 4 to 19 (inclusive)
Even values between 5 and 12 (inclusive)
Exercise
The fibonacci sequence is given as:
0, 1, 1, 2, 3, 5, 8, 13, .
Write pseudocode to print the first 50 fibonacci
numbers
Exercise
Write code to do the following:
Your code should count from 0 to 100
If the current number is divisible by 3, print fizz
If the current number is divisble by 5 print buzz
If it is divisible by 3 and 5, print fizzbuzz
Otherwise, print the number
Functions
f(x) = 3x + 2
Exercise
Change your fibonacci code to be a function. The
function should take in a value called N and return
the Nth fibonacci number. So if N = 1 then return
0, if N = 2 then return 1, etc.
Write a function called mult that takes in two values,
x and y, and returns the product. You may not use
* to accomplish this.