#include <stdio.h>
long factorial(int num);
int main()
{
int t;
scanf("%d", &t);
while(t--)
{
int num;
scanf("%d", &num);
printf("%d\n", factorial(num));
}
return 0;
}
long factorial(int num)
{
if(num == 0) return 1;
else return (num * factorial(num - 1));
}
So this is my solution to small factorial problem, when I tested it locally it gives the desired output but when I submit this it flags it as wrong one. Can someone let me know why it is wrong?