#include<stdio.h>
#include<conio.h>
int main()
{
int a[3][3],i,j,item,flag=0;
printf("Enter the data in the array:-");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("Enter the element to be searched");
scanf("%d",&item);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
if(item==a[i][j])
{
flag=1;
printf("Element found at position=%d,%d",i,j);
}
}
}
if (flag==0)
printf("Element not found");
getch();
}
No comments:
Post a Comment