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.



									/*****Please include following header files*****/
// cstdint
/***********************************************/

bool IsStrongNumber(int number) {
	int64_t fact;
	int num = number;
	int64_t 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