Armstrong Number in C

#include <stdio.h>
main()
{
int num, sum = 0, t, r;
printf("Enter a number\n");      
scanf("%d",&num);
t = num;
while( t != 0 )
{
 r = t%10;
 sum = sum + r*r*r;
 t = t/10; 
 }
 if ( num == sum )
printf("the number is an armstrong number.");
else
printf("the number is not an armstrong number.");         
}