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.
IN MY SOLUTION ONE TEST CASE IS NOT PASSING
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin>>n;
long long int a[1000];
long long int max=0;
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
if(a[i]>max){
max =a[i];
}
}
cout<<max;
}