-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLinearsearch.c
More file actions
27 lines (23 loc) · 839 Bytes
/
Linearsearch.c
File metadata and controls
27 lines (23 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include<stdio.h>
int main()
{
int a[100],search,c,n;
printf("Enter no of element in array\n");
scanf("%d",&n);
printf("Enter %d integer\n",n);
for(c=0;c<n;c++)
scanf("%d",&a[c]);
printf("Enter A Number To Search\n");
scanf("%d",&search);
for(c=0;c<n;c++)
{
if(a[c]==search)
{
printf("%d is present at %d location",search,c+1);
break;
}
}
if(c==n)
printf("%d Is Not Present At Location\n",search);
return 0;
}