Could you tell me where i am getting wrong

question link:
max value in Array

answer:
#include
using namespace std;
int max_value(int A[],int N)
{
int i;
int max=A[0];
while(N>0)
{
for(i=0;i<=N-1;i++)
if(A[i]>max)
{
max=A[i];
}
}
return max;

}

int main() {

int N,i;
cin>>N;
int A[N];
for(i=0;i<=N-1;i++)
{
	cin>>A[i];
}
cout<<max_value(A,N)<<endl;



return 0;

}

no need to use a while loop,
N is always greater than 0(as you don’t update N), so it goes in infinite loop.