#include<stdio.h>
int main()
{
int array[100],array1[100];
int i,n,m;
int flag=0;
printf("Please Enter The 1st array size: ");
scanf("%d",&n);
printf("
Please Enter %d elements of the array:
",n);
for(i=0; i<n; i++)
{
scanf("%d",&array[i]);
}
printf("Please Enter the element you want to search: ");
scanf("%d",&m);
for(i=0; i<n; i++)
{
if(array[i]==m) /// checking if there is the element available or not
{
flag=1; ///if found,make the flag=1 and stop the loop
break;
}
}
if(flag==1)
{
printf("
Match!!!!
");
}
else
{
printf("
Not Match!!!
");
}
return 0;
}
Output
Please Enter The 1st array size:3
Please Enter 3 elements of the array: 34 19 4
Please Enter the element you want to search: 19
Match!!!!
Add your comment