b. list of intergers using linear search method

program:

#include<stdio.h>

#include<conio.h>

void main()

{

int i,a[20],n,key,flag=0;

clrscr();

printf("Enter the size of an array\n");

scanf("%d",&n);

printf("Enter the array elements");

for(i=0; i<n;i++)

{

scanf("%d",&a[i]);

}

printf("Enter the key elements");

sacnf("%d", &key);

for(i=0;i<n;i++)

{

if(a[i]==key)

{

flag=1;

break;

}

}

if(flag==1)

printf("The key elements is found at location %d",i+1);

else

printf("The key element is not found in the array");

getch();

}

output: