+ 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....
8 Réponses
+ 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.
+ 3
One way is with A bunch of if statements.
+ 3
how do you receive numbers? are they all different? Is it an assignment?
0
can you please tell me the coding of this condition?
0
please tell me the coding of this question
0
I get the number through arguments & all they are different.