Take 10 integer inputs from user and store them in an array. Again ask user to give a number. Now, tell user whether that number is present in array or not.
Answers
Answered by
1
Answer:
yes it is in an array I can't explain it but
Answered by
0
Answer:
Explanation:
#include <iostream>
using namespace std;
int main ()
{
int a[10],num;
for (int i=0; i<10; i++)
{
cout<< "Enter a number: "<<endl;
cin>>a[i];
}
cout<< "enter a number: "<<endl;
cin>>num;
int found=0;
for (int i=0; i<10; i++)
{
if(a[i]==num)
{
found=1;
break;
}
}
if(found)
cout<<num<< " is present in array. ";
else
cout<<num<< " is not present in array.";
return 0;
}
Similar questions