Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<conio.h>
- using namespace std;
- int main()
- {
- int arr[10], i, num, index;
- cout<<"Enter 10 numbers:\n";
- for(i=0; i<10; i++) {
- cin>>arr[i];
- }
- cout<<"\nEnter a number to search: ";
- cin>>num;
- for(i=0; i<10; i++)
- {
- if(arr[i]==num) {
- cout<<"\nFound at index no. "<<i;
- break;
- }
- }
- if(i==10) {
- cout<<"\nElement not present in the array.";
- }
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement