Problem: Write a pseudocode to read in two numbers and find the average of the numbers print the average
Solution: Here is a pseudocode that reads in two numbers and calculates their average.
# Get the first number
PRINT "Enter the first number:"
# Get the second number
PRINT "Enter the second number:"
# Calculate the average of the two numbers
average = (firstNumber + secondNumber) / 2
# Print the average
PRINT "The average of the two numbers is: " + average
Here is a breakdown of the pseudocode:
The code starts by printing a prompt asking the user to enter the first number.
The user inputs the first number and it is stored in a variable called
The code then prints a prompt asking the user to enter the second number.
The user inputs the second number and it is stored in a variable called
The code calculates the average of the two numbers by adding
secondNumber and dividing the result by 2. The average is stored in a variable called
The code prints the value of
average, which is the average of the two numbers.
The code ends.