Minimum of three numbers

  • 7
  • Locked
"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.
You can't complete this task, because you're not signed in.
Comments (89)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Nuhazet
Level 4 , Santa Cruz de Tenerife, Spain
23 April, 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!
Jeongmin
Level 7 , Tsche-mul-p-ho, Korea, Republic of
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.
Anonymous #10795220
Level 2 , Chicago, Argentina
23 August 2021, 00:13
1 -3 3 5 Esta es la salida cual es el error , por favor?
Steve C. Ands
Level 8 , Medellín, Colombia
16 November 2021, 21:52
Me sucede lo mismo el método está bien y sale eso. Y resulta en error.
Anonymous #10795220
Level 2 , Chicago, Argentina
23 August 2021, 00:12
No se que esta mal el resultado esta bien!!!
Víctor Alfonso Martínez Gómez
Level 3 , Manizales, Colombia
10 August 2021, 22:31
if (a
Víctor Alfonso Martínez Gómez
Level 3 , Manizales, Colombia
10 August 2021, 22:31
if (a una pequeña ayuda para iniciar su código.
Toka
Level 10 , Dugo Selo, Croatia
10 July 2021, 14:07
I solved the task with 2x Math.min() method and it works :)
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
Agustín Fernández
Level 2 , Castelar
31 May 2021, 12:03
Agree with Carlos! We got no info at all about " ? : " Try to resolved it with if else statement but it did not achieve last requirement. Thought this course would be better :(
Marcus Lindbloom
Level 22 , Lidkoping, Sweden
18 May 2021, 19:28
I get the output 1, -3, 3, 5 which should be correct? Or am I misunderstanding something?
Toka
Level 10 , Dugo Selo, Croatia
10 July 2021, 14:06
yes