Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Strong_number
- {
- class Program
- {
- static void Main(string[] args)
- {
- string number = Console.ReadLine();
- int factoriel = 1;
- int result = 0;
- for (int i = 0; i < number.Length; i++)
- {
- int singleDigit = int.Parse(number[i].ToString());
- for (int j = 1; j <= singleDigit; j++)
- {
- factoriel *= j;
- }
- result += factoriel;
- factoriel = 1;
- }
- if (result==int.Parse(number))
- {
- Console.WriteLine("yes");
- }
- else
- {
- Console.WriteLine("no");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment