Take as input N, the size of array. Take N more inputs and store that in an array. Write a function which returns the maximum value in the array. Print the value returned.
1.It reads a number N.
2.Take Another N numbers as input and store them in an Array.
3.calculate the max value in the array and return that value.
this is my code 2 test cases are passed other two are not successfull (1st and 3rd) plz help
#include
int main() {
int N;
std::cin>>N;
if(N>=0)
{int arr[N];
int max;
for(int i=0;i<=N;i++){
std::cin>>arr[i];
if(arr[i]>-1000000000 && arr[i]<1000000000){
max=arr[0];
if(arr[i]>max)
{
max==arr[i];
}
}}
std::cout<<max;
}
return 0;
}