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 (76)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Level 8
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
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?
Level 8
10 July, 14:06
Aisuluu Zhumabaeva SDET at Capgemini
22 April, 18:02
I'm having difficulty understand this task
Level 3 , San Antonio, United States
13 October 2020, 21:10
Use if , esle if , else , and &&
Nina Tuttle
Level 4 , Champaign, United States
8 October 2020, 02:41
Please can anybody help me to figure out what is wrong with my code. Thank you
Level 41
9 October 2020, 05:38
Please post your question with the attached solution in the section Help.
kenneth payne
Level 3 , San Diego, United States
19 September 2020, 20:48
I just have a question about my code, it works and has passed the test criteria. However, when I attempted to utilize an "else" statement at the end of the "if" statement, I kept getting an error " int minimum may not have been initialized" and the value of the first output statement displayed the maximum value, but when I added the third "if" statement, the error went away and the program ran perfectly. why is that? what am I not understanding within the context of "if/else" statements?
Level 7 , Enschede, Netherlands
10 September 2020, 19:11
multipe solutions exist but codegym is looking for a certain way we did not read yet in the theory.
Anthony Mazzie
Level 5 , Des Moines, United States
14 July 2020, 23:00
This took me waaaay longer than it should have. Make sure you're using "<=" and not only "<". Have fun!
Level 5 , Kansas City, United States
16 December 2020, 20:34
thanks for this tip!
Level 3 , Hicksville, United States
14 June 2020, 19:12
Is the output suppose to be 1, -3, 3, & 5? If so, I have the correct output, but it is not accepting it as a right answer. Is this an error?