Advertisements
Advertisements
Question
Write a C++ program to input ‘n’ elements in an one dimensional array and input one another number and check whether this number is present in the array or not.
Code Writing
Advertisements
Solution
#include <iostream.h>
main()
{
int i, n, n1 x(10), p = 0;
cout "Enter the value of n";
cin>>in;
cout<<"/n Input Elements";
for (i - 1< = ic - n ; i++)
cin>>x[i];
cout<<:\n Enter the number to be cheek";
cin>>h1;
for (i = 1; i< = n ; i++)
{
it (n1 = = x[i])
P = 1;
}
if (P = = 0)
count<<"\n No is not found";
else
cout<<"in No is found";
return(0);
}shaalaa.com
Is there an error in this question or solution?
