Maximum of four numbers

  • 4
  • Locked
Finding the maximum is an n-ary operation (an operation on n numbers) that returns the largest of several numbers. Never mind. We have no need for such definitions at the secret CodeGym center. We're here to learn how to write code. In this task, you need to use the keyboard to enter four numbers. Then determine the largest of them and display it on the screen.
You can't complete this task, because you're not signed in.
Comments (21)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Anonymous #10771395 Backend Developer
13 August, 06:52
why this solution is considered wrong? I've tried it several times and everything seems fine.
John Squirrels Website Admin at CodeGym
14 August, 10:56
Please use the Help option within the task menu, if you are having issues with verification.
Jomar Tayactac
Level 6 , Winnipeg, Canada
1 August, 00:18
I used Arrays.sort() to get the max number.
Anonymous #10775689
Level 14 , United Kingdom
26 July, 15:52
coffeemess
Level 7 , Versailles, France
21 June, 19:50
used arrays.sort :)
schipplock Backend Developer at n/a
4 July, 18:03
lol :)
Seth Barker
Level 5 , Eureka Springs, United States
26 January, 20:27
The topic of Level 4 Lesson 6 should give some insight as to how to correct your code. It was so simple once I realized the most important word. "Equal to"
Khongpak Phupkdee
Level 15 , Chiangrai, Thailand
23 January, 14:23
Thank the community help, because I forgot the negative value. If your result from your code It will be ok but you can't pass in Requirements 3 and 4. Try to change your input data from 8,9,5,8 to -8,-9,-5,-8, and check your result again! Good luck
Ryan Palmer
Level 19 , Philadelphia, United States
16 January, 04:43
When using Intellij how do you input your own numbers? When I attempt to use "Run" and then type in the console I can only enter 1 number. When I push enter I receive the following message. xception in thread "main" java.lang.NumberFormatException: For input string: "1 " at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68) at java.base/java.lang.Integer.parseInt(Integer.java:652) at java.base/java.lang.Integer.parseInt(Integer.java:770) at com.codegym.task.task04.task0419.Solution.main(Solution.java:13)
Alex
Level 41 , Solar System
16 January, 17:10
Please contact Support with a screenshot of your task via support@codegym.cc.
Roman
Level 41
18 January, 06:52
Your input string is "1 " (spaces after the number are an error) You should enter only the number.
Joe M
Level 11 , Owings Mills, United States
27 September 2020, 19:45
used Math.max and Buffered Reader!! woohoo!
Jordan
Level 6 , Muncie, United States
4 July 2020, 05:26
Hey first time posting in here but I am confused why / how I can get the correct output but still not pass verification. Can anyone see what I am missing? Thank you!
Lucas Hoage
Level 14 , Savannah, United States
25 May 2020, 18:35
Hint: If you were able to complete Level 2 Lesson 8 (Minimum of Four Numbers), the same rules apply. Only instead of creating a separate method to do the work, it can all be done with if statements in the main. Extra Hints: Research the commands min and max. You can call them through the Math class or you can call them through the Integer class. An example of calling this would be exactly how you call parse. Extra Extra Hints: if you add 2 numbers together and divide them by 2, what is the answer? Can that result somehow complete one of the conditions of the assignment?