C Program to check whether a given number is an Armstrong Number or not using in built power function

Program

#include<stdio.h>
#include<math.h>
void main()
{
    int num, sum = 0, temp, rem, digits = 0;
    printf("Input an integer\n");
    scanf("%d", &num);
    temp = num;
    while (temp != 0)
    {
        digits++;
        temp = temp / 10;
    }
    temp = num;
    while (temp != 0)
    {
        rem = temp % 10;
        sum = sum + pow(rem, digits);
        temp = temp / 10;
    }
    if (num == sum)
        printf("%d is an Armstrong number.\n", num);
    else
        printf("%d is not an Armstrong number.\n", num);
}

Output 1

$ ./a.out
Input an integer
76
76 is not an Armstrong number.

Output 2

$ ./a.out
Input an integer
370
370 is an Armstrong number.