Not all labels are equally useful, but sometimes a lack of labels results in chaos. Let's do a task that dishes out labels: use the keyboard to enter an integer, and make the program indicate whether the number is negative or positive (or zero), and even or odd. Why do we need this? Just because, for practice. After all, we're here to learn!
Labels and numbers
- 4
Locked
Comments (12)
- Popular
- New
- Old
You must be signed in to leave a comment
furius72
20 October 2022, 18:26
hi after an afternoon i understood that the text could be cut in two different string "negative" .... "even number" ....
0
EvelynSt
9 October 2022, 14:33
Is possible do this task with switch?
0
Ice_ Beam
19 April 2021, 11:24
I have a question regarding my formula:
Why won't it print out anything for the negative odd formula? I mean the other odd positive formula was the same, but it printed out the results. Am I missing a hidden rule here?
it only worked when I changed it to != 0 instead of ==1 0
Roman
23 April 2021, 05:28
Try this:
and look at the result) +1
Joe M
28 September 2020, 17:31
got it but still IJ is giving me the "not using println()" error....copied/pasted into here and no issues
0
Ganesh Kumar S M
2 January 2020, 15:20
If the exercise is too hard or if we make minor mistakes then I believe we need to know the answers. I know we have to try ourselves to complete the task but sometimes we also need to know the answers to the tasks so that we can see if we can improve the answers. Please have a separate section for the correct answers. That will help a lot.
+1
Alex
16 March 2021, 21:57
You can review and download the correct answer from the help menu.
0
Richard Melton
16 December 2019, 22:44
ok so is my logic off or did I screw up the syntax anybody have any suggestions?
0
Kent Hervey Software Engineer/Consult at Zeal IT ConsultantsExpert
14 October 2019, 16:24
Why doesn't this work for negative numbers?
if(enteredNumber%2==1){
System.out.println("is odd");
}
0
Kent Hervey Software Engineer/Consult at Zeal IT ConsultantsExpert
14 October 2019, 16:46
Because the result would be -1...I solved by using -1. but in real life I might use abs
0
Michael Martin
2 November 2018, 18:59
Can anyone tell me why the conditions no longer appear on the left hand side? It's really annoying to copy the conditions to notepad just so I can look at them while I am coding. When I started this course, they showed up on the left side, but then something happened, and now I only get the folder structure. Anyone know of any way to change this? Thanks!
0
Roman
6 November 2018, 08:00
Thank you very much, we will take into account your wishes. In future releases this will be implemented.
0