Q. Write an algorithm that accepts four numbers as input and find the largest and smallest of them.


Answer :-

Input first number
Input second number
Input third number
Input fourth number

Set lst = [ first , second, third , forth ]
Sort the lst
lst.sort( )

Print greatest number is lst [ -1 ]
Print smallest number is lst [ 0 ]

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post