We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b895794 commit d607eaeCopy full SHA for d607eae
Searches/linears.c
@@ -0,0 +1,26 @@
1
+#include<stdio.h>
2
+
3
+int main()
4
+{
5
+ int a[20],i,x,n;
6
+ printf("How many elements?");
7
+ scanf("%d",&n);
8
9
+ printf("Enter array elements:\n");
10
+ for(i=0;i<n;++i)
11
+ scanf("%d",&a[i]);
12
13
+ printf("\nEnter element to search:");
14
+ scanf("%d",&x);
15
16
17
+ if(a[i]==x)
18
+ break;
19
20
+ if(i<n)
21
+ printf("Element found at index %d",i);
22
+ else
23
+ printf("Element not found");
24
25
+ return 0;
26
+}
0 commit comments