Quick actions

cmd+k|ctrl+k

Navigation

Languages

linear search

Snippet info

Language

Cpp

Visibility

public

Author

mothilaljadav0304

Created

2026-06-27T20:36:40.861872Z

Updated

2026-06-27T20:36:40.861872Z

#include <iostream>
using namespace std;

int main() {
    int A[6], n= 6, key;
    for(int i=0;i<n;i++){
        cin>> A[i];
    }
    
    cin>>key;
    
    for(int i=0;i<n;i++){
        if(A[i]==key){
            cout<<"found the key at index "<<i;
            return 0;
        }
    }
    
    cout<<"key is not found";
    return 0;
}
INFO