What is the issue with this code in C


#1

int trailingZeroes(int A) {
int i;
int factorial = A;
for (i = A; i <= 2; i–)
{
factorial = factorial * (i - 1);
}

int j = 0;
int a;
while (factorial / 10 != 0)
{
a = factorial % 10;
if (a == 0)
j++;
else 
return j;
}

}


#2

issues: 1) overflow of variable factorial in case of large value of A.
2)it runs in O(n) time complexity and will give TLE.