I am trying to learn Java and one of the test exercises wants me to
write a program that takes three integers as input and then sorts them
from lowest to highest...

So for example if the input is "3" "1" and "6", the output would be
"1", "3", "6"

It sounds really simple in my head but for some reason I'm having
problems looking at it from an algortihmic perspective.

I've tried doing something like this:

// Declare the variables to hold the numbers
int num1, num2, num3;

// Code to get input from user goes here

// Declare variables for output
int firstLargest, secondLargest, thirdLargest = 0;

// Here is where I get stuck.

I tried to set firstLargest equal to num1 one and then compare the
other two numbers to firstLargest, and that will get me the largest one
of the three, but I can't figure out what to do with the other two
numbers.  I think what I truely need help with to learn programming is
not so much how to write code, it's how to approach the problem I'm
trying to solve programmatically in a logical, algorithmic way......

Anyway, you now know what I'm trying to do.  Any help or guidance would
be most appreciated.  Thanks for reading.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to