If user input 3 numbers in any order. How do I code in Java so that it displays the largest number first to the smallest number last. My logic is so: Take every number and subtract it from the other numbers. When subtract if result is positive tally qty of positive per number. The number with must positive tally is Largest, and so on. The question is is this logic code-able in Java or is there a better method than my logic?
User input these 3 numbers: 5 , 3, 7 (n1, n2, n3)
1st vs. 2nd
5-3= 2 (positive} <----2nd winner
3-5= -2
1st vs. 3rd
5-7 =-2
7-5 = 2 (positive) <-----winner
2nd vs. 3rd
3-7= -4
7-3 = 4 (positive) <--------winner