#include<iostream.h>
#include<conio.h>
void sum(int a[10][10],int r,int c);
void main()
{
clrscr();
int a[10][10],r,c,i,j;
cout<<"\n\n";
cout<<"enter row and column";
cout<<"\n\n";
cin>>r;
cout<<"\n\n";
cin>>c;
cout<<"\n\n";
cout<<"enter elements";
cout<<"\n\n";
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cout<<"\n";
cin>>a[i][j];
}
}
sum(a,r,c);
getch();
}
void sum(int a[10][10],int r,int c)
{
int i,j,sum=0;
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
if(a[i][j]%2==0||a[i][j]%3==0)
{
sum=sum+a[i][j];
}
}
}
cout<<"\n\n";
cout<<"sum of nos. divisible by 2 and 3 is"<<"\n\n"<<sum;
}
#include<conio.h>
void sum(int a[10][10],int r,int c);
void main()
{
clrscr();
int a[10][10],r,c,i,j;
cout<<"\n\n";
cout<<"enter row and column";
cout<<"\n\n";
cin>>r;
cout<<"\n\n";
cin>>c;
cout<<"\n\n";
cout<<"enter elements";
cout<<"\n\n";
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cout<<"\n";
cin>>a[i][j];
}
}
sum(a,r,c);
getch();
}
void sum(int a[10][10],int r,int c)
{
int i,j,sum=0;
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
if(a[i][j]%2==0||a[i][j]%3==0)
{
sum=sum+a[i][j];
}
}
}
cout<<"\n\n";
cout<<"sum of nos. divisible by 2 and 3 is"<<"\n\n"<<sum;
}