Positive and negative numbers

  • 4
  • Locked
Data analysis starts with a simple concept: we need to understand what data matters and should be used, and what data should be discarded. Let's solve a simple data analysis problem. We enter three integers from the keyboard, then we'll analyze them and display the number of positive and negative numbers in the source set.
You can't complete this task, because you're not signed in.
Comments (13)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Usman Full Stack Developer at QA
28 June 2021, 11:05
what does point 3 and 4 of the requirements mean? The program should display the number negative numbers in the original set. The program should display the number of positive numbers in the original set. I am not passing on this, despite getting the right output
ImDevin
Level 15 , Old Town, United States
1 April 2021, 02:44
create an else statement that doesn't do anything. I just wonder how practically applicable in a real coding situation. I guess I'll eventually find out! Happy coding.
Libby
Level 20 , United Kingdom
3 January 2021, 16:09
Can anyone specify clearly what's supposed to be done to meet the last requirement?
Roman
Level 41
4 January 2021, 09:13
Please post your question with the attached solution in the section Help.
sanjukta singha
Level 5 , Bangalore, India
17 June 2021, 07:47
you need two if statements, one (a>0) and another a<0, by doing this you skip counting in the zero.
Marios
Level 7 , Greece
18 September 2020, 09:17
Please, I need guidance in regards to " Note that 0 is not a positive or negative number. ". I can not pass it. Here is my source code: https://pastebin.com/xrFu2d5V I paste it here, because I exceeded the character limit.
Sekh Parvez
Level 8 , New York City, United States
23 October 2020, 15:39
do you still need help with this?
Devonte A
Level 18 , Rubery, United Kingdom
4 May 2020, 10:41
For anyone struggling on the last case, create a condition that does nothing if the value is 0. :D
Syed Huzaifa
Level 7 , Karachi, Pakistan
6 May 2020, 22:15
int a = 0;
       int b = 3;
       if(num1>0){
           a++;
           b--;
       }if(num2>0){
           a++;
           b--;
       }if(num3>0){
           a++;
           b--;
       }else if(num1==0){
           // a++;
           // b--;
       }else if(num2==0){
           // a++;
           // b--;
       }else if(num3==0){
           // a++;
           // b--;
       }
       System.out.println("Number of negative numbers: "+b);
       System.out.println("Number of positive numbers: "+a);
not working for this code
Sean Nigito
Level 7 , Newark, United States
7 August 2020, 17:05
you have 2 problems that i can see 1: you should make separate if statements for your inputs 2: you don't need to subtract 1 from one variable and add to another you can just add to one of them
23 August 2020, 01:20
you could use a loop for this task to make things easier.
Anita Pal
Level 14 , India
29 July 2019, 09:49
Can anyone help me.I am not able to find error in my code.
smaranika sahu
Level 5 , Pune, India
16 July 2019, 07:25
Can anyone help me what is wrong in my code?