diff --git a/key.cpp b/key.cpp new file mode 100644 index 0000000..d9a2735 --- /dev/null +++ b/key.cpp @@ -0,0 +1,29 @@ +#include +using namespace std; +int main() +{ +int size = 10; +int array[size]; +for (int i = 0; i< size; i++) +{ +cout<< "Index " <> array[i]; +} +int key; +cout<< "\nEnter the number you want to search: "; +cin>>key; +int ele = -1; +for (int i = 0; i< size; i++) +{ +if (array[i] == key) +{ +ele = i; + +} +} +cout<< "\nThe index of number " << key << " is " <