Help me in solving LPYAS154 problem

My issue

Failed on a hidden test casefailed on hidden test case

My code

#include <stdio.h>

// Function to calculate the sum of factors excluding 1 and the number itself
int sum_of_factors_excluding_one_and_self(int n) {
    int factor_sum = 0;

    // Loop through possible factors
    for (int i = 2; i < n; i++) { // Start from 2 and end before n
        if (n % i == 0) {         // Check if i is a factor
            factor_sum += i;
        }
    }

    return factor_sum;
}

int main() {
    int N;

    // Read the input
    printf("Enter a number (N ≤ 100): ");
    scanf("%d", &N);

    // Ensure the input meets the constraints
    if (N > 1 && N <= 100) {
        int result = sum_of_factors_excluding_one_and_self(N);
        printf("Sum of factors excluding 1 and %d: %d\n", N, result);
    } else {
        printf("Please enter a number greater than 1 and less than or equal to 100.\n");
    }

    return 0;
}

Learning course: Algorithmic Problem Solving
Problem Link: https://www.codechef.com/learn/course/klu-problem-solving/KLUPS00A/problems/LPYAS154