Write a Program in C/ C++ that asks from user to enter any 10 array elements, and then ask to enter a number to search from the given array.
Write a Program in C/ C++ that asks from user to enter any 10 array elements, and then ask to …
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
#include <iostream> using namespace std; int main(){ int input[100], count, i, num; cout << "Enter Number of Elements in Array\n"; cin >> count; cout << "Enter " << count << " numbers \n"; for(i = 0; i < count; i++){ cin >> input[i]; } cout << "Enter a number to serach in Array\n"; cin >> num; for(i = 0; i < count; i++){ if(input[i] == num){ cout << "Element found at index " << i; break; } } if(i == count){ cout << "Element Not Present in Input Array\n"; } return 0; }