Linear search
void main()
{
int a[10],i,n,m,c=0;
clrscr();
printf("Enter the size of an array->");
scanf("%d",&n);
printf("\nEnter the elements of the array->");
for(i=0;i
for(i=0;i
scanf("%d",&m);
for(i=0;i
{
if(a[i]==m)
{
c=1;
break;
}
}
if(c==0)
printf("\nThe number is not in the list");
else
printf("\nThe number is found");
getch();
}
0 comments:
Post a Comment