Help me in solving LPYAS151 problem

My issue

give coorect answer

My code

#include <stdio.h>
#include <math.h>

// Function to check if a number is an Armstrong number
int is_armstrong(int n) {
    int original_num = n;
    int sum_of_powers = 0, num_digits = 0, digit;

    // Count the number of digits in the number
    int temp = n;
    while (temp != 0) {
        temp /= 10;
        num_digits++;
    }

    // Calculate the sum of the nth powers of each digit
    temp = n;
    while (temp != 0) {
        digit = temp % 10;
        sum_of_powers += pow(digit, num_digits);
        temp /= 10;
    }

    // Check if the sum of powers is equal to the original number
    if (sum_of_powers == original_num) {
        return 1;  // Armstrong number
    } else {
        return 0;  // Not Armstrong number
    }
}

int main() {
    int N;
    
    // Input
    printf("Enter a number: ");
    scanf("%d", &N);
    
    // Output the result
    if (is_armstrong(N)) {
        printf("Armstrong\n");
    } else {
        printf("Not Armstrong\n");
    }

    return 0;
}

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