public class compositenumbersinArray {
public static void main(String[] args) {
int a[] = { 16, 18, 27, 16, 23, 21, 19 };
int len = a.length;
int count = 0;
for (int i = 0; i < len; i++) {
int c = 0;// inside an array counts factors
for (int j = 1; j < 100; j++) {
if (a[i] % j == 0) {
c++;
}
}
if (c > 2) {
count++;
}
}
System.out.println(count);
}
}
package com.dain.logics;
public class compositenumbersinArray { public static void main(String[] args) { int a[] = { 16, 18, 27, 16, 23, 21, 19 }; int len = a.length; int count = 0;