Max value in array

one of my test cases is showing error. please help.

#include
using namespace std;
int main() {

int A[100],n;

cin>>n;
int max=0;

for(int i=0;i<n;i++){

	cin>>A[i];	
}

for(int j=0;j<n;j++){
	if(A[j]>max){
		max= A[j];
	}
}
cout<<max;

}code