Pseudocode Examples

Pseudocode to Find Average of Two Numbers1 min read

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.




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 firstNumber.

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 secondNumber.

The code calculates the average of the two numbers by adding firstNumber and secondNumber and dividing the result by 2. The average is stored in a variable called average.

The code prints the value of average, which is the average of the two numbers.

The code ends.

Leave a Comment