Array-04. Search for integers (10), array-04
This question requires that the given X be searched from the N integers entered. If it is Found, the position of output X (starting from 0); if it is Not Found, the output is "Not Found ".
Input Format:
The input returns two positive integers N (<= 20), X, and N integers in row 1st. The numbers cannot exceed the length integer and are separated by spaces.
Output Format:
Output the position of X in a row, or "Not Found ".
Input Example 1:
5 73 5 7 1 9
Output Example 1:
2
Input Example 2:
5 73 5 8 1 9
Output Example 2:
Not Found
# Include <stdio. h>
Int main (){
Int n, x, I, flag = 1;
Scanf ("% d", & n, & x );
Long int str [25];
For (I = 0; I <n; I ++ ){
Scanf ("% ld", & str [I]);
}
For (I = 0; I <n; I ++ ){
If (str [I] = x ){
Printf ("% d", I );
Flag = 0;
}
}
If (flag)
Printf ("Not Found ");
Return 0;
}