My issue
include <stdio.h>
int main() {
// your code goes here
int T,N,A[10],i,max;
scanf(“%d”,&T);
scanf(“%d”,&N);
for(i=0;i<N;i++)
{
scanf(“%d”,&A[i]);
}
max=A[0];
for(i=0;i<N;i++)
{
if(A[i]>max)
{
max=A[i];
}
}
printf(“%d”,max);
return 0;
}
output is same as required but there is runtime error.
My code
#include <stdio.h>
int main() {
// your code goes here
int T,N,A[10],i,max;
scanf("%d",&T);
scanf("%d",&N);
for(i=0;i<N;i++)
{
scanf("%d",&A[i]);
}
max=A[0];
for(i=0;i<N;i++)
{
if(A[i]>max)
{
max=A[i];
}
}
printf("%d",max);
return 0;
}
Learning course: BCS301: Data structures
Problem Link: https://www.codechef.com/learn/course/abesit-dsa/ABESITDS06/problems/UWCOI20A