FCTRL Factorial: Unable to find why I am getting wrong answer error even though the code runs fine in code blocks

#include<stdio.h>

#define size 65535

int main(){

           unsigned long long int N = 0, zeros = 0;
           unsigned long int T;
           char buffer[size];
           int i, c;

           scanf("%lu", &T);
           printf("\n");

           while(T > 0 && (c = fread(buffer, sizeof(char), size, stdin)) > 0)
           {
                          for( i = 0; i < c; i++)
                          { 
                                         if(buffer[i] == '\n')
                                         {
                                                        T--;
                                                        zeros = 0;
                                                        if (N >= 5)
                                                        {
                                                                       while(N > 0)
                                                                       {
                                                                                      N = N/5;
                                                                                      zeros = zeros + N;
                                                                       }
                                                        }
                                                        printf("%llu\n", zeros);
                                         } 
                                         else
                                         {
                                                        N = (N * 10) + (buffer[i] - '0');
                                         }

                          }
           }

           return 0;

}