Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. public class Program
  5. {
  6. public static void Main()
  7. {
  8. int num = int.Parse(Console.ReadLine());
  9. int a = num;
  10. int b = num;
  11. int counter = 0;
  12. while (true)
  13. {
  14. a /= 10;
  15. counter++;
  16. if (a == 0)
  17. {
  18. break;
  19. }
  20. }
  21. int sum = 1;
  22. int counterA = 0;
  23. for (int i = 0; i < counter; i++)
  24. {
  25. int diget = num % 10;
  26. counterA++;
  27. for (int j = 1; j <= diget; j++)
  28. {
  29. sum *= j;
  30. }
  31. num /= 10;
  32. }
  33. if (sum == b)
  34. {
  35. Console.WriteLine("yes");
  36. }
  37. else
  38. {
  39. Console.WriteLine("no");
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement