Write a program that displays all numbers divisible by 3 and 4 within a range entered by user. Display five numbers per line. Numbers are separated by exactly two spaces.
This is my code
public class Chapter4 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
final int NUMBER_OF_PRIMES_PER_LINE = 5;
int count = 0;
int[] vars = new int[10];
for (int i = 0; i < vars.length; i++) {
System.out.println("Enter " + (i + 1) + " numbers: ");
vars[i] = input.nextInt();
if ((vars[i] % 3 == 0) && (vars[i] % 4 == 0)) {
count++;
}
if (count % NUMBER_OF_PRIMES_PER_LINE == 0) {
System.out.println(vars[i]+" ");
}
}
}
}
I input value 120 10 times, but I only get one 120 displayed at the end.