Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp2
- {
- class Program
- {
- static void Main()
- {
- int inputNum = int.Parse(Console.ReadLine());
- long checkNum = inputNum;
- long factorialSum = 0;
- while (checkNum != 0)
- {
- long result = checkNum % 10;
- checkNum /= 10;
- long factorial = 1;
- for (int i = 1; i <= result; i++)
- {
- factorial *= i;
- }
- factorialSum += factorial;
- }
- if (factorialSum == inputNum)
- {
- Console.WriteLine("yes");
- }
- else
- {
- Console.WriteLine("no");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement