Knowee
Questions
Features
Study Tools

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.

🧐 Not the exact question you are looking for?Go ask a question

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.

This problem has been solved

Similar Questions

Write a pseudo code + Draw Flowchart that find the biggest of three (3) Numbers

Write a C++ code to find largest among 4 numbers  using the concept call by reference.

Write a program to display a menu driven facility to find the greatest of two numbers,three numbers and four numbers

Write a program to print the following output: [3] 5 5 5 5 5 4 4 4 4 3 3 3 2 2 1

What will be the output of the following pseudocode?Integer p, q, rset p=1, q=2, r=0if (p < q )p= p << 1if ( p > q ) r= r << 1end ifprintf p + q + r

1/3

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.