We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
int main()
{
int N,i,l=0;;
int B[100];
printf("enter no of people in a row");
scanf("%d",&N);
printf("enter of loafs given to each individual");
for(i=1;i<=N;i++)
{
scanf("%d",B[i]);
}
for(i=1;i<=N;i++)
{
l=l+(B[i]/N);
}
if(l%2==0)
{
printf("%d",l);
}
else{
printf("NO");
}
return 0;
}
after submitting it shows segmentation fault at each case
what is segmentation fault????
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Fair Rations
You are viewing a single comment's thread. Return to all comments →
int main() { int N,i,l=0;; int B[100]; printf("enter no of people in a row"); scanf("%d",&N); printf("enter of loafs given to each individual"); for(i=1;i<=N;i++) { scanf("%d",B[i]); } for(i=1;i<=N;i++) { l=l+(B[i]/N); } if(l%2==0) { printf("%d",l); } else{ printf("NO"); } return 0; } after submitting it shows segmentation fault at each case what is segmentation fault????