Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _06StrongNumber
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int number = int.Parse(Console.ReadLine());
  10. string factorial = number.ToString();
  11. int sum = 0;
  12. int sum1 = 1;
  13.  
  14.  
  15.  
  16.  
  17.  
  18. for (int i = 0; i < factorial.Length; i++)
  19. {
  20. int currentNumber = 0;
  21. int.TryParse(factorial[i].ToString(), out currentNumber);
  22.  
  23.  
  24. for (int y = 1; y <= currentNumber; y++)
  25. {
  26. sum1 = sum1 * y;
  27. }
  28. sum += sum1;
  29. sum1 = 1;
  30. }
  31. if (sum == number)
  32. {
  33. Console.WriteLine("yes");
  34. }
  35. else
  36. {
  37. Console.WriteLine("no");
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement