Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions 2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ using namespace std;
int main()
{

int arr[10], i, num, n, c=0, pos;
cout<<"Enter the array size : ";
int a[10], i, num, n, c=0, p;
cout<<"Enter size of array : ";
cin>>n;
cout<<"Enter Array Elements : ";
cout<<"Enter the Elements : ";
for(i=0; i<n; i++)
{
cin>>arr[i];
cin>>a[i];
}
cout<<"Enter the number to search : ";
cout<<"Enter the number you want to search : ";
cin>>num;
for(i=0; i<n; i++)
{
if(arr[i]==num)
if(a[i]==num)
{
c=1;
pos=i+1;
p=i+1;
break;
}
}
Expand All @@ -28,8 +28,8 @@ int main()
}
else
{
cout<<num<<" found at position "<<pos;
cout<<num<<" found at position "<<p;
}

return 0;
}