Help me in solving DSAAGP50 problem

My issue

why the entered code is wrong

My code

#include <stdio.h>

int main() {
	// your code goes here
int arr[100]={8,2,4,1,4};
int n=5;
int sum=0;
for(int i=0;i<n;i++)
{
    sum=sum+arr[i];
}
printf("%d",sum);
return 0;
}


Learning course: BCS301: Data structures
Problem Link: https://www.codechef.com/learn/course/abesit-dsa/ABESITDS06/problems/DSAAGP50

here the correct code

#include <stdio.h>

int main() {
	// your code goes here
int arr[]={8,2,4,1,4};
int n=sizeof(arr)/sizeof(arr[0]);
int sum=0;
for(int i=0;i<n;i++)
{
    sum=sum+arr[i];
}
printf("%d",sum);
return 0;
}

attach the question also