printing number of pos/neg numbers input?
i need to write a code that when you input 5 numbers, it displays how many pos, neg and 0s were entered. i thought i was pretty close...but as you can see my output is not right. can someone please point me in the right direction from herE? thank you.
Code:
import java.util.Scanner;
public class negposzerovals {
public static void main(String[] args) {
int n1;
int n2;
int n3;
int n4;
int n5;
int posnum;
int negnum;
int zeros;
posnum = 0;
negnum = 0;
zeros = 0;
Scanner input = new Scanner (System.in);
System.out.print("Please enter first number:");
n1 = input.nextInt();
if (n1 > 0);
posnum++;
if (n1==0);
zeros++;
if (n1 < 0);
negnum++;
System.out.print("Please enter second number:");
n2 = input.nextInt();
if (n2 > 0);
posnum++;
if (n2==0);
zeros++;
if (n2 < 0);
negnum++;
System.out.print("Please enter third number:");
n3 = input.nextInt();
if (n3 > 0);
posnum++;
if (n3==0);
zeros++;
if (n3 < 0);
negnum++;
System.out.print("Please enter fourth number:");
n4 = input.nextInt();
if (n4 > 0);
posnum++;
if (n4==0);
zeros++;
if (n4 < 0);
negnum++;
System.out.print("Please enter fifth number:");
n5 = input.nextInt();
if (n5 > 0);
posnum++;
if (n5==0);
zeros++;
if (n5 < 0);
negnum++;
System.out.print("There were " + posnum + " positive numbers entered, " + negnum + "negative numbers entered, and " + zeros + "zeros entered.");
}
}