Created
September 23, 2021 16:29
-
-
Save suryansh011/df82501e38fe6c0bd4240d552c6c3a61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
int m, n, i, out; | |
scanf("%d", &m); | |
int arr[m]; | |
for(i = 0; i < m; i++) | |
scanf("%d", &arr[i]); | |
scanf("%d", &n); | |
for(i = 0; i < m; i++) | |
if (arr[i] == n) { | |
out = i+1; | |
break; | |
} | |
else | |
out = -1; | |
printf("%d", out); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment