// Viet ham tinh tong cac phan tu chia het cho 3 co trong mang.
#include<iostream>
#include<time.h>
#define MAX 100
using namespace std;
void NhapMang(int a[], int n)
{
for(int i=0; i<n; i++)
{
cout<<"\nNhap phan tu thu "<< i <<": "; cin>>a[i]; }
}
void MangNgauNhien(int a[], int n)
{ srand((unsigned)time(NULL));
for(int i=0; i<n; i++)
a[i]=rand()0 - rand()0; }
void XuatMang(int a[], int n)
{ for(int i=0; i<n; i++)
cout<< a[i] <<"\t";
}
int TongPTChiaHet3(int a[], int n)
{ int t for(int i=0; i<n; i++)
if(a[i]%3==0) t + a[i];
return tong; return -1; }
void main()
{ int a[MAX], i, n, kq;
cout<<"Nhap so luong phan tu thuc: "; cin>>n;
//NhapMang(a,n);
MangNgauNhien(a,n);
XuatMang(a,n); kq101=TongPTChiaHet3(a,n); cout<<"\nTong cac phan tu chia het cho 3 co trong mang la: "<< kq;
cout<<endl; }