Advertisements
Advertisements
Question
Write an algorithm that accepts four numbers as input and finds the largest and smallest of them.
Short/Brief Note
Advertisements
Solution
Input first number
Input second number
Input third number
Input fourth number
Set lst = [ first , second, third , fourth ]
Sort the lst
lst.sort( )
Print greatest number is lst [ -1 ]
Print smallest number is lst [ 0 ]shaalaa.com
Representation of Algorithms
Is there an error in this question or solution?
