Duplicate

This algorithm is a duplicate. We already have a linear search in this repo
This commit is contained in:
Christian Bender 2019-02-12 16:17:22 +01:00 committed by GitHub
parent 1f9a5168c7
commit e2c0a7a6e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,26 +0,0 @@
#include<stdio.h>
int main()
{
int a[20],i,x,n;
printf("How many elements?");
scanf("%d",&n);
printf("Enter array elements:\n");
for(i=0;i<n;++i)
scanf("%d",&a[i]);
printf("\nEnter element to search:");
scanf("%d",&x);
for(i=0;i<n;++i)
if(a[i]==x)
break;
if(i<n)
printf("Element found at index %d",i);
else
printf("Element not found");
return 0;
}