Construct a Pseudocode to take three numbers and print largest and smallest among them.
Question
Construct a Pseudocode to take three numbers and print largest and smallest among them.
Solution
Sure, here is a pseudocode to solve the problem:
1. Start
2. Declare variables num1, num2, num3, largest, smallest
3. Read values for num1, num2, num3
4. Assume num1 is the largest and smallest
Set largest = num1
Set smallest = num1
5. If num2 is greater than largest then,
Set largest = num2
6. If num3 is greater than largest then,
Set largest = num3
7. If num2 is less than smallest then,
Set smallest = num2
8. If num3 is less than smallest then,
Set smallest = num3
9. Print largest
10. Print smallest
11. End
This pseudocode will take three numbers as input and then it will compare each number with the others to find the largest and smallest numbers. It first assumes the first number is the largest and smallest, then it checks the other two numbers one by one. If it finds a number larger than the current largest, it updates the largest. Similarly, if it finds a number smaller than the current smallest, it updates the smallest. Finally, it prints out the largest and smallest numbers.
Similar Questions
Write a pseudocode to find the smallest number using divide and conquer
algorithms to find largest and second largest and smallest of three numbers
Given 3 integer values, arrange those 3 values in ascending order using macrosInput Format:Accept three integer values as a inputOutput Format:Print the output as "min < mid < max
Accept three numbers from the user and display the second largest number.
Write a pseudo code + Draw Flowchart that find the biggest of three (3) Numbers
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.