Searching in arr

#include
using namespace std;
int main()
{
int arr[]={12,45,89,63,57,-96,32};
int n=sizeof(arr)/sizeof(arr[0]);
int key=0,i;
for( i=0;i<n;i++){
if(arr[i]==key){
cout<<i<<endl;
break;
}

    }
    if(i==n){
        cout<<-1<<endl;
}
return 0;

}

so in this code atlast why we have written -1 in the last cout statement

hi @shwetap1100_980008b8ff2159cd,

if u dont find the element then u need to 
print -1 
as it reaches the end of the loop which is
 i == n