Advertisement
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 P02SumOfDigits
- {
- class Program
- {
- static void Main(string[] args)
- {
- int num = Int32.Parse(Console.ReadLine());
- int temp = num;
- int sum = 0;
- while (num != 0)
- {
- int product = 1;
- int digit = num % 10;
- num = num / 10;
- while (digit > 0)
- {
- product *= digit;
- digit--;
- }
- sum += product;
- }
- if (sum == temp)
- {
- Console.WriteLine("yes");
- }
- else
- {
- Console.WriteLine("no");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement