# Find the biggest and smalles of A,B,C by algorithm

Solved/Closed
YemenSEF Posts 2 Registration date Monday November 26, 2012 Status Member Last seen August 19, 2013 - Nov 26, 2012 at 06:23 AM
Zohaib R Posts 2368 Registration date Sunday September 23, 2012 Status Member Last seen December 13, 2018 - Nov 29, 2012 at 01:19 PM
Hello,

This is my first question ^^ , I just joined the collage but i have a question related to algorithm
its how to write whats the biggest and smallest value in 3 vars A,B,C
did a flowchart for it but cant change it to algoritm to short form :(
for 1 answer its easy
-start
IF A>B & A>C
then A is the biggest
Else IF B>C
then B is the biggest
Else then C is the biggest
Print the biggest
-end

Regards

???? ???? , ?? ?????? ?????
Related:

## 3 responses

Zohaib R Posts 2368 Registration date Sunday September 23, 2012 Status Member Last seen December 13, 2018 69
Nov 26, 2012 at 02:39 PM
Hi YemenSEF,

You can try the below mentioned algorithm:

largest = x
smallest = x

if (y > largest) then largest = y
if (z > largest) then largest = z

if (y < smallest) then smallest = y
if (z < smallest) then smallest = z

If you want to write the same in any programming language do reply.

Please revert for clarification.
Zohaib R Posts 2368 Registration date Sunday September 23, 2012 Status Member Last seen December 13, 2018 69
Nov 29, 2012 at 01:19 PM
Hi YemenSEF,

I appreciate your hard work. Yes, your algorithm will give you the right results. Feel free to approach if you need any further help.
YemenSEF Posts 2 Registration date Monday November 26, 2012 Status Member Last seen August 19, 2013
Nov 27, 2012 at 05:46 PM
Thanks very much
but i have already tried alot and found a good answer andi hope its right too
I did one like this
-start