Help me in solving LPYAS154 problem

My issue

include <stdio.h>

int sum_of_factors(int n) {
int sum = 0;
// Loop through possible factors from 2 to n-1
for (int i = 2; i < n; i++) {
if (n % i == 0) { // If i is a factor
sum += i;
}
}
return sum;
}

int main() {
int N;
printf(“Enter an integer N (N ≤ 100): “);
scanf(”%d”, &N);

// Check constraints
if (N > 1 && N <= 100) {
    int result = sum_of_factors(N);
    printf("%d\n", result);
} else {
    printf("Please enter a valid integer within the specified range.\n");
}

return 0;

}

My code

#include <stdio.h>
int sum_of_factors(int n) {
    int sum = 0;
    // Loop through possible factors from 2 to n-1
    for (int i = 2; i < n; i++) {
        if (n % i == 0) {  // If i is a factor
            sum += i;
        }
    }
    return sum;
}

int main() {
    int N;
    printf("Enter an integer N (N ≤ 100): ");
    scanf("%d", &N);

    // Check constraints
    if (N > 1 && N <= 100) {
        int result = sum_of_factors(N);
        printf("%d\n", result);
    } else {
        printf("Please enter a valid integer within the specified range.\n");
    }

    return 0;
}




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