Why my code fails to pass all the test cases?

#include
using namespace std;
void LinearSearch(int a[] , int n , int num)
{
int i;
for(int i=0;i<n;i++)
{
if(a[i]== num)
{
cout<<i<<endl;
break;

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

}
int main() {
int n;
cin>>n;
int a[n];

for(int i=0;i<n;i++)
{
	cin>>a[i];
}
int num;
cin>>num;
LinearSearch(a , n ,num);
return 0;

}

hi @deepshreyamishra301_1918130c8477386b,
dont write
int i in for loop its making local variable and not using the above one
check here https://ide.codingblocks.com/s/660513