/*PROGRAM TO SEARCH AN ELEMENT IN THE MATRIX*/
#include<stdio.h>
#include<conio.h>
void main()
{
int m,n,i,j,srch,count=0,a[5][5];
clrscr();
printf(“Enter the order of matrix: “);
scanf(“%d%d”,&m,&n);
printf(“Enter %d elements in the matrix:\n”,m*n);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf(“%d”,&a[i][j]);
}
printf(“Entered elements are:\n”);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
printf(“%d\t”,a[i][j]);
printf(“\n”);
}
printf(“Enter the element you want to search: “);
scanf(“%d”,&srch);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if(srch==a[i][j])
count++;
}
}
if(count==0)
printf(“Element is not found in the matrix”);
else
printf(“%d is found %d times in the matrix”,srch,count);
getch();
}