Positive and negative numbers

  • 4
  • Locked
Diego is tall, but Alfredo is short. Rishi is experienced, but you're a "noob" programmer. Comparisons are unavoidable in life. And the same thing is true in programs. So we'll continue practicing comparisons and displaying stuff on the screen. This time let's compare the entered number with zero and manipulate it based on the result of the comparison.
You can't complete this task, because you're not signed in.
Comments (28)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Nuhazet
Level 4 , Santa Cruz de Tenerife, Spain
25 April 2022, 21:42
If the entered number is zero("0"), display "0". Not "zero" 🤣🤣🤣 OMG
Roman
Level 41
6 May 2022, 09:54
Fixed)
Mohammad Jihad Uddin
Level 4 , Chicago, United States
4 March 2021, 18:25
Hello Everyone, To complete this task go to Level 3, Lesson 12 (Financial Expectations). Copy what you did there, and then from there simply create an if, else if, and else statement!
Marius Moldovan
Level 8 , WGC, United Kingdom
25 November 2020, 19:54
Instead of "If the entered number is zero, display zero." it should be "If the entered number is zero, display 0." I was thinking that for the value of 0 I need to output the String zero.
28 August 2020, 17:39
You have to add the import java.util.Scanner; at the beginning of the code.
Marek Pasierbek Working at Nexus Polska
10 June 2020, 16:53
who now what is wrong?
Rebekah H
Level 8 , Gothenburg, Sweden
2 May 2020, 15:58
Is it better to write A:
int num = math(myScannerClass.nextInt());
or B:
int num = myScannerClass.nextInt();
num = math(num);
why?
Laura
Level 7 , Lübeck, Deutschland
13 August 2020, 11:53
Lol I never use Scanner always BufferedReader
Damodar Gopagoni
Level 11 , Singapore, Singapore
2 March 2020, 09:10
I have finished this task by using below for key board. however not sure how it is different from scanner method. for any clarity? thanks BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Damodar Gopagoni
Level 11 , Singapore, Singapore
2 March 2020, 08:54
Can't we use scanner for user input, my code is not being accepted though it is giving correct result? can any body help on this
Scott Böning
Level 14 , Deggendorf, Germany
6 January 2020, 21:29
If your code works in IntelliJ or another IDE but you get error messages when validating remove (or comment out) the prompt for user input!
17 November 2019, 11:44
whats wrong in my code? can anyone help plz?
Roman
Level 41
18 November 2019, 06:19
Please use the Help section for questions relating to tasks.