Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int a[100],key,n;
- cin>>n;
- for(int i=0; i<n; i++)
- {
- cin>>a[i];
- }
- cout<<endl;
- for(int i=0; i<n; i++)
- {
- cout<<a[i]<<" ";
- }
- cout<<endl;
- cin>>key;
- cout<<endl;
- for(int i=0; i<n-1; i++)
- {
- if(a[i]==key){
- cout<<key<<" Found at index "<<i;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement