In the following question(CHEFEZQ Problem - CodeChef) many of the users are getting SIGFPE error including me.
Even though there is no case where one is dividing the numerator by 0 or using a smaller data type.
Please do help me and the many other fellow coders in understanding what is causing that error.
Thank you
1 Like
for(int i=0;i<numOfdays;i++)
{
daysTaken++;
scanf("%ld",&ques);
totalQues=totalQues+ques;
if(totalQues<chefAnswer)
{
checker=1;
break;
}
else
totalQues=totalQues-chefAnswer;
}
in ur code if after an iteration of the for loop chefAnswer>totalQues , u r breaking the loop , so u
aren't taking input after that, hence "sigfpe" .
2 Likes
Thanks a lot my friend,this helped me solve my problem 
Actually I had the same thought as you before i even submitted my code even once and therefore i checked for error using custom input but in that case i got no error and got my result.Howsoever it caused a problem here,you know why?
BTW a lot of other user user have the same doubt and are asking about it in the editorial so i think you answer would be really appreciated there 