I want the program to ask me how many numbers I want to enter and then show me if each number I entered is a cousin or no cousin, but instead I am getting a number and immediately tell me if it is a cousin or not, then the next number and it tells me if it is a cousin or not, and so, with the n numbers that I decide to enter.
My code:
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner leer=new Scanner(System.in);
int N, i, z;
N=leer.nextInt();
for(i=1;i<=N;i++){
z=leer.nextInt();
if(z%2!=0||z==2){
System.out.println("primo");
}
else{
System.out.println("no primo");
}
}
}
}
And this is what I'm getting (vertically)
3
2
cousin
1
no cousin
5
cousin
When I want to, it's
3
2
1
5
cousin no cousin cousin