Skip to content

Commit

Permalink
day28_solved (#212)
Browse files Browse the repository at this point in the history
* Create day28_solved

Linear Search

* Rename day28_solved to day28_shubhendra-20
  • Loading branch information
shubhendra-20 authored and MadhavBahl committed Feb 8, 2019
1 parent 34a8adb commit df5aee6
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions day28/CPP/day28_shubhendra-20
@@ -0,0 +1,34 @@
/*
Author: Shubhendra Singh
github: shubhendra-20
*/

#include <iostream>
using namespace std;

int main() {
int i,j,n,x,flag;

cin>>n;
int a[n];
for(i=0;i<n;i++)
{
cin>>a[i];
}
cin>>x;
flag=0;
for(i=0;i<n;i++)
{
if(a[i]==x)
{
flag=1;
cout<<(i+1)<<endl;
break;
}
}
if(flag==0)
{
cout<<"undefined";
}
return 0;
}

0 comments on commit df5aee6

Please sign in to comment.