I dont understand the above answer but i don't think it will work . here's a better one.
void func(int a[10][10],int row,int col)
{
int i,j,b[100],k=0;
for(i=0;i<row;i++)
for(j=0;j<col;j++)
if(a[i][j]%3==0 ||a[i][j]%5==0)
b[k++]= a[i][j];
cout<<"\n\nThe required array is \n";
for(i=0;i<k;i++)
cout<<'\t'<<b[i];
}