public class Demo { public static void main(String[] args) { int[] arr = new int[]{68, 27, 95, 88, 171, 996, 51, 210}; int sum = 0; for (int x = 0; x <= arr.length - 1; x++) { if (arr[x] % 2 == 0 && arr[x] % 10 != 7 && arr[x] / 10 % 10 != 7) { sum += arr[x]; } } System.out.println(sum); } }
输出结果:1362