#include<stdio.h>
int ans(int n)
{
int a[n],i,m=0;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
if(m<a[i])
{
m=a[i];
}
}
return m;
}
int main()
{
int n;
scanf("%d",&n);
printf("%d",ans(n));
return 0;
}
Failure of testcase
@Shivam31 hey shivam you are enrolling into a c++ based course. please up upgrade yourself and error in your code is m=0; it should be m=a[0];
and after taking input array
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
do this like
m=a[0];
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
sir my task is still incomplete even after submitting the right code and getting all the 4 testcase right. i am getting thee red circle , i had tried hard refresh as wellbut still