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 (87)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Jeongmin
Level 3 , Tsche-mul-p-ho, Korea, Republic of
23 September, 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, 00:13
1 -3 3 5 Esta es la salida cual es el error , por favor?
Anonymous #10795220
Level 2 , Chicago, Argentina
23 August, 00:12
No se que esta mal el resultado esta bien!!!
Víctor Alfonso Martínez Gómez
Level 3 , Manizales, Colombia
10 August, 22:31
if (a
Víctor Alfonso Martínez Gómez
Level 3 , Manizales, Colombia
10 August, 22:31
if (a una pequeña ayuda para iniciar su código.
Toka
Level 10 , Dugo Selo, Croatia
10 July, 14:07
I solved the task with 2x Math.min() method and it works :)
4 June, 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, 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 9 , Lidkoping, Sweden
18 May, 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, 14:06
yes
Aisuluu Zhumabaeva SDET at Capgemini
22 April, 18:02
I'm having difficulty understand this task