"Don't compare me with others!" she cried. But comparisons are unavoidable in this world. Especially in programming. Let's take three numbers, look at them, and figure out which one is the smallest. We'll do this using a program, more precisely, a special min method that calculates which number is smaller than the other two.
Minimum of three numbers
- 7
Locked
Comments (92)
- Popular
- New
- Old
You must be signed in to leave a comment
Sergio
30 December 2022, 11:22
The key is to create two methods: min1() and min2() in order to compare one pair at time. Then compare two methods only.
0
Lunita
27 December 2022, 20:39
Como lo logré:
+1
Nuhazet
23 April 2022, 08:51
Si te está dando problemas esta tarea, prueba con comparar también por igualación ( a <= b && a <= b )
Mucho ánimo!
If you are having problems with this task, try to compare also by equalization ( a <= b && a <= b ).
Cheer up!
+3
Lunita
27 December 2022, 20:41
Eso fue lo que me funciono! Tambien poner
al final de todo el bloque. 0
Jeongmin
23 September 2021, 11:55
It was tricky to achieve the goal using if, && operator, else if. There were two same values and it made my program working the wrong way.
Instead, I took a two-step approach. First, compare a and b, then save min. Next, compare min and c.
+2
Anonymous #10795220
23 August 2021, 00:13
1
-3
3
5
Esta es la salida cual es el error , por favor?
0
Steve C. Ands
16 November 2021, 21:52
Me sucede lo mismo el método está bien y sale eso. Y resulta en error.
0
Anonymous #10795220
23 August 2021, 00:12
No se que esta mal el resultado esta bien!!!
0
Víctor Alfonso Martínez Gómez
10 August 2021, 22:31
if (a
0
Víctor Alfonso Martínez Gómez
10 August 2021, 22:31
if (a una pequeña ayuda para iniciar su código.
0
Toka
10 July 2021, 14:07
I solved the task with 2x Math.min() method and it works :)
+1
Jose Antonio Fernández G
4 June 2021, 15:56
i solved the task creating another method min(int a, int b). You can create a method who compare the values of "a" and "b" to see which of them is the minimum. After you can declare a new variable on method min(x, x,x) referenced to the previus method "m2 = min(x,x)" and do the comparation
+5