#include
using namespace std;
int main() {
int n;
int arr[n];
int max=0;
cin>>n;
for (int i=0;i<n;i++)
{
cin>>arr[i];
if (max<arr[i])
{
max=arr[i];
}
}
cout<<max;
return 0;
}
This code is working but one of the test case is failing.
#include
using namespace std;
int main() {
int n;
int arr[n];
int max=0;
cin>>n;
for (int i=0;i<n;i++)
{
cin>>arr[i];
if (max<arr[i])
{
max=arr[i];
}
}
cout<<max;
return 0;
}
This code is working but one of the test case is failing.
Take max value as ar[0], instead of 0 and then try to submit your code.
Did that but still the third test case is failing.
I have modified your code a little bit, kindly see to it