/*****************<soeasyprograms.blogspot.in>******************/
/*Program to perform linear search*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,element,a[100];
clrscr();
printf("Enter tne total number of elements");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("Enter the %d element:",i);
scanf("%d",&a[i]);
}
printf("Enter the element to be search: ");
scanf("%d",&element);
for(i=1;i<=n;i++)
{
if(element==a[i])
printf(" Element is found at %d place",i);
}
getch();
}
/*****************<soeasyprograms.blogspot.in>******************/
/*End of program*/
No comments:
Post a Comment