Help me in solving LPYAS153 problem

My issue

code

My code

#include <stdio.h>

// Function to calculate factorial of a number
unsigned long long factorial(int n) {
    unsigned long long fact = 1;
    for (int i = 1; i <= n; i++) {
        fact *= i;
    }
    return fact;
}

// Function to calculate the sum of digits of a number
int sum_of_digits(unsigned long long n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10; // Add the last digit to sum
        n /= 10; // Remove the last digit
    }
    return sum;
}

int main() {
    int t, n;
    
    // Read the number of test cases
    scanf("%d", &t);
    
    // Process each test case
    for (int i = 0; i < t; i++) {
        // Read the integer N for the current test case
        scanf("%d", &n);
        
        // Calculate the factorial of N
        unsigned long long fact = factorial(n);
        
        // Calculate the sum of the digits of the factorial
        int result = sum_of_digits(fact);
        
        // Output the result
        printf("%d\n", result);
    }
    
    return 0;
}

Learning course: Roadmap to 3*
Problem Link: https://www.codechef.com/learn/course/klu-roadmap-3star/KLURMP300B/problems/LPYAS153