ALGORITHM LAB PROGRAMS
/*CSEMATTER.BLOGSPOT.IN
SEQUENTIAL SEARCH PROGRAM
Program:Program in C to perform sequential search*/
#include<stdio.h>
#include<conio.h>
void main()
{
int arr[20],num,count,term,found=0;
clrscr();
printf("enter the no. of elements to enter");
scanf("%d",&num);
printf("enter the numbers");
for(count=0;count<num;count++)
{scanf("%d",&arr[count]);}
printf("enter the term to be searched");
scanf("%d",&term);
for(count=0;count<num;count++)
{
if(arr[count]==term)
{printf("term found at %d position in array",count+1);
found=1;
break;
}
}
if(found==0)
printf("term no found");
getch();
}
/*enter the no. of elements to enter 5
enter the numbers
10
94
66
78
12
enter the term to be searched 78
term found at 4 position in array*/
good one...:D :D
ReplyDeletei mean... the image..:D