Example1: Write pseudo code that reads two numbers and multiplies them together and print out their product.
Output:"Please Enter 2 Numbers:"
Input int a,b
Output a*b
Example2:Write pseudo code that tells a user that the number they entered is not a 5 or a 6.
Output:"Please Enter a Number:"
Input int a
If a!=5||a!=6
Output:"No"
Else
Output:"Yes"
End if
Example 3: Write pseudo code that performs the following: Ask a user to enter a number. If the number is between 0 and 10, write the word blue. If the number is between 10 and 20, write the word red. If the number is between 20 and 30, write the word green. If it is any other number, write that it is not a correct color option.
Output:"Please enter a number:"
Input an integer n
If 0-9
Output: "Blue"
Else if 10-19
Output: "Red"
Else 20-30
Output: "Green"
Else
Output:"Wrong Color Option"
End if
Example 4: Write pseudo code to print all multiples of 5 between 1 and 100 (including both 1 and 100).
Output:"This program will print all multiples of 5 between 1 and 100."
While int i>=1&&i<=100
If i%5==0
Output i
End if
i++
End loop
Example 5: Write pseudo code that will count all the even numbers up to a user defined stopping point.
Output:"Please Enter a Number:"
Input int a
While i>=0&&i<=a
If i%2==0
Output i
End if
i++
End loop
Example 6: Write pseudo code that will perform the following.
a) Read in 5 separate numbers.
b) Calculate the average of the five numbers.
c) Find the smallest (minimum) and largest (maximum) of the five entered numbers.
d) Write out the results found from steps b and c with a message describing what they are
Output:"Please Enter 5 Numbers:"
Input int a[0], a[1], a[2], a[3], a[4]
int b
Output "The Average is (a[0]+ a[1]+ a[2]+ a[3]+a[4])/5"
int max=0
For(int i=0;i<=4;i++)
for (int j=0;j<=4)
If a[i]>=a[j]
b=a[j]
a[j]=a[i]
a[i]=b
End if
End loop
End loop
Output "Output the smallest one is a[0], and the largest one is a[4]"
Example 7: Write a pseudocode solution which will take in an integer value and determine whether that value is odd or even.
Output:"Please Enter a Number:"
Input int a
If a%2==0
Output:"Even"
Else
Output:"Odd"
End if