Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _01ExerciseStrongNumber
- {
- class Program
- {
- static void Main(string[] args)
- {
- int number = int.Parse(Console.ReadLine());
- int copy = number;
- int currentNumber = 0;
- int factSum = 0;
- while (copy != 0)
- {
- currentNumber = copy % 10;
- copy = copy / 10;
- int fact = 1;
- for (int i = 1; i <= currentNumber; i++)
- {
- fact = fact * i;
- }
- factSum = factSum + fact;
- }
- if (number == factSum)
- {
- Console.WriteLine("yes");
- }
- else
- {
- Console.WriteLine("no");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement