Help me in solving LPYAS151 problem

My issue

amstrong num code

My code

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

int main() {
    int N, originalN, remainder, n = 0, sum = 0;

    // Read the input number
    printf("Enter an integer: ");
    scanf("%d", &N);
    
    originalN = N;
    

    // Calculate the number of digits
    while (originalN != 0) {
        originalN /= 10;
        n++;
    }

    originalN = N;

    // Calculate the sum of the nth powers of its digits
    while (originalN != 0) {
        remainder = originalN % 10;
        sum += pow(remainder, n);
        originalN /= 10;
    }

    // Check if the sum is equal to the original number
    if (sum == 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