1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#include<iostream>
using namespace std;
int main() //You cannot set return type of main to void
//My compiler gave me an error.
{
int a;
int arr[5][5]={{5,2,7,9,10},{4,7,10,11,13},{5,8,3,2,9},{83,57,3,7,14},{1,8,17,34,60}};
bool isFound = 0;
cout<<"Enter a number :\n";
cin>>a;
for(int i=0;i<5;i++)
{
for(int j=0;j<5;j++)
{
if(a==arr[i][j])
{
isFound = 1;
break;
}
else
{
isFound = 0;
}
}
if(isFound)
{
cout << "Number is found.\n";
break;
}
}
if(!isFound)
cout << "Number is not found.\n";
system("pause");
return 0;
}
|