package com.itheima.test04;
public class Test01 {
public static void main(String[] args) {
/* A. 定义一个数组,存储以下信息:
78 23 56 89 88 84 72 99 56 72 100 53 28
B. 求数组中所有偶数的和*/
int[] arr = {78,23,56,89,88,84,72,99,56,72,100,53,28};
int temp = 0;
int count = 0;
for(int i = 0; i<arr.length;i++){
if(arr[i]%2==0){
temp +=arr[i];
count++;
}
}
System.out.println(temp);
System.out.println(count);
}
}
|
|