+ 1

How to find second largest number in 5 integers value without using array or loop?

if I have 5 integer values so how can I find the 2nd largest value without using array or loop....

26th Oct 2017, 6:33 PM
Nilesh Gupta
8 ответов
+ 8
Keep a variable for the largest and second largest. Then, test for which one is larger. if (largst < input) then input becomes the new largest. And second largest becomes whatever the largest was. else if (secLargst < input) Then second largest becomes the input.
27th Oct 2017, 1:13 AM
Rrestoring faith
Rrestoring faith - avatar
+ 3
One way is with A bunch of if statements.
26th Oct 2017, 6:39 PM
Rrestoring faith
Rrestoring faith - avatar
+ 3
how do you receive numbers? are they all different? Is it an assignment?
26th Oct 2017, 9:44 PM
Vahid Shirbisheh
Vahid Shirbisheh - avatar
0
can you please tell me the coding of this condition?
26th Oct 2017, 6:43 PM
Nilesh Gupta
0
please tell me the coding of this question
26th Oct 2017, 6:50 PM
Nilesh Gupta
0
I get the number through arguments & all they are different.
27th Oct 2017, 1:05 AM
Nilesh Gupta