diff --git a/Add Code Here/C++/Arrays/LinearSearch.cpp b/Add Code Here/C++/Arrays/LinearSearch.cpp index 1687c1da0f3..e27ffdc84ae 100644 --- a/Add Code Here/C++/Arrays/LinearSearch.cpp +++ b/Add Code Here/C++/Arrays/LinearSearch.cpp @@ -1,15 +1,21 @@ #include using namespace std; -int main(){ - int A[10] = {10,512,8,82,8,55,44,55,45,45}, key; + +int main() { + int A[10] = {10, 512, 8, 82, 8, 55, 44, 55, 45, 45}; + int key; + cout << "Enter Key: "; cin >> key; - for(int i =0; i< 10 ; i++){ - if (key == A[i]){ - cout << "Found at " << i << endl; - return 0; - } + for (int i = 0; i < 10; i++) { + if (key == A[i]) { + cout << "Found at index " << i << endl; + return 0; + } } - cout << "Jane de n vro!"; -} \ No newline at end of file + + cout << "Key not found!" << endl; + + return 0; +}