Is Strong Number

This algorithm checks whether a given number is strong number or not. Strong numbers are the numbers whose sum of factorial of digits is equal to the original number.



									public static bool IsStrongNumber(int number)
{
	long fact;
	int num = number;
	long sum = 0;

	while (number != 0)
	{
		fact = 1;

		for (int i = 1; i <= number % 10; ++i)
			fact *= i;

		sum += fact;

		number /= 10;
	}

	return sum == num;
}
								


Example

									bool isStrongNumber = IsStrongNumber(145);
								


Output

									true