chantb

mail@pastecode.io avatar
unknown
plain_text
a month ago
344 B
3
Indexable
Never
#include <iostream>
using namespace std;
int main()
{
    int n, cnt = 0, sum = 0;
    cin >> n;
    int arr[n];
    for(int i = 0; i < n; i++){
        cin >> arr[i];
        if(arr[i] % 2 == 0){
            cnt++;
            sum += arr[i];
        }
    }
    cout << "Trung binh cac so chan trong mang la: " << sum / cnt;
}
Leave a Comment