Skip to content

Commit

Permalink
Merge pull request #100 from r99wq/main
Browse files Browse the repository at this point in the history
Create linear.c
  • Loading branch information
aman-raza authored Oct 21, 2020
2 parents b3c813c + becd52b commit 838acad
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions linear.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include<stdio.h>

int main()
{
int a[20],i,x,n;
printf("enter number of elements : ");
scanf("%d",&n);

printf("Enter array elements : ");
for(i=0;i<n;++i)
scanf("%d",&a[i]);

printf("Enter 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;
}

0 comments on commit 838acad

Please sign in to comment.