Skip to content

Commit df5aee6

Browse files
shubhendra-20MadhavBahl
authored andcommitted
day28_solved (#212)
* Create day28_solved Linear Search * Rename day28_solved to day28_shubhendra-20
1 parent 34a8adb commit df5aee6

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

day28/CPP/day28_shubhendra-20

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
Author: Shubhendra Singh
3+
github: shubhendra-20
4+
*/
5+
6+
#include <iostream>
7+
using namespace std;
8+
9+
int main() {
10+
int i,j,n,x,flag;
11+
12+
cin>>n;
13+
int a[n];
14+
for(i=0;i<n;i++)
15+
{
16+
cin>>a[i];
17+
}
18+
cin>>x;
19+
flag=0;
20+
for(i=0;i<n;i++)
21+
{
22+
if(a[i]==x)
23+
{
24+
flag=1;
25+
cout<<(i+1)<<endl;
26+
break;
27+
}
28+
}
29+
if(flag==0)
30+
{
31+
cout<<"undefined";
32+
}
33+
return 0;
34+
}

0 commit comments

Comments
 (0)