Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- int main()
- {
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- int tc;
- cin >> tc;
- int n;
- cin >> n;
- int arr[n];
- for(int i=0;i<n;i++)
- cin >> arr[i];
- int c=1;
- while(tc--)
- {
- int ques;
- cin >> ques;
- bool flag = false;
- int ind;
- for(int i=0;i<n;i++)
- {
- if(arr[i]==ques)
- {
- flag = true;
- ind = i;
- break;
- }
- }
- if(flag)
- printf("%d is found at index %d\n",ques,ind);
- else
- printf("%d is not found in the array\n",ques);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement