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(5)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Devonte ALevel 17 , Rubery
4 May, 10:41
For anyone struggling on the last case, create a condition that does nothing if the value is 0. :D
Syed HuzaifaLevel 7 , Karachi
6 May, 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 NigitoLevel 4 , Newark
Friday, 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
Anita PalLevel 14
29 July 2019, 09:49
Can anyone help me.I am not able to find error in my code.
smaranika sahuLevel 5 , Pune
16 July 2019, 07:25
Can anyone help me what is wrong in my code?