Number is a strong number or not

C program to check whether a number is a Strong Number or not.

When the sum of the factorial of a number’s individual digits is equal to the number itself, then that number is called a strong number.

For example, Let num = 145
Sum of factorial of digits = 1! + 4! + 5! = 1 + 24 + 120 = 145
Hence, 145 is a strong number

Some of the strong numbers are: 1, 2, 145, 40585, ...

Program

#include<stdio.h>
#include<conio.h>
void main()
{
	int num, i, j, fact, sum, temp;

    printf("Enter the number\t:");
    scanf("%d",&num);

    temp = num;
    sum = 0;
    while(temp > 0)
    {
        i = temp % 10;
        fact = 1;
        for(j=1;j<=i;j++)
		{
			fact = fact * j;
		}
		sum = sum + fact;
		temp = temp / 10;
    }
    if(num == sum)
        printf("%d is a strong number",num);
    else
        printf("%d is not a strong number",num);
    getch();
}

Output

********** Run1 **********

Enter the number        :40585
40585 is a strong number



********** Run2 **********

Enter the number        :45
45 is not a strong number