C PROGRAMMINGDATA STRUCTURES
linear search on array
linear search
#include<stdio.h>
#include<conio.h>
main()
{
int array[20],size,search,loop;
printf("Enter the size of arrayn");
scanf("%d",&size);
printf("Enter %d elements of arrayn",size);
for(loop=0;loop<size;loop++)
{
scanf("%d",&array[loop]);
}
printf("Enter the element of array to search n");
scanf("%d",&search);
for(loop=0;loop<size;loop++)
{
if(array[loop]==search)
printf("%d found at %d in array",search,loop+1);
}
getch();
}