Why my solution to problem is flagged wrong?

#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?

Try something like factorial(100). You need a function to handle such big numbers. Another practice for you :slight_smile:

//