#include <stdio.h>
int main()
{
int array[100][100];
int i,j,r,c,n;
int flag=0;
printf("Please Enter how many row and column you want to use: ");
scanf("%d %d",&r,&c);
printf("Please Enter the elements of the array:
");
for (i=0; i<r; i++)
{
for (j=0; j<c; j++)
{
scanf("%d",&array[i][j]);
}
}
printf("Please Enter the Number You want to Search: ");
scanf("%d",&n);
for (i=0; i<r; i++)
{
for (j=0; j<c; j++)
{
if(array[i][j]==n)
{
flag=1;
break;
}
}
}
if(flag==1)
{
printf("
Matched!!!!
");
}
if(flag==0)
{
printf("
Don't Match!!!!
");
}
return 0;
}
Output
Please Enter how many row and column you want to use:3 3
Please Enter the elements of the array:
1 2 3
4 5 6
7 8 9
Please Enter the Number You want to Search: 5
Matched!!!
Add your comment