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;
- class Program
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- bool isFound = false;
- for (int a = 1; a <= 9; a++)
- {
- for (int b = 9; b >= a; b--)
- {
- for (int c = 0; c <= 9; c++)
- {
- for (int d = 9; d >= c; d--)
- {
- if ((a + b + c + d) == (a * b * c * d) && (n % 10 == 5))
- {
- Console.WriteLine(a * 1000 + b * 100 + c * 10 + d);
- isFound = true;
- return;
- }
- else if (((a * b * c * d) / (a + b + c + d) == 3) && (n % 3 == 0))
- {
- Console.WriteLine((d * 1000 + c * 100 + b * 10 + a));
- isFound = true;
- return;
- }
- }
- }
- }
- }
- if (isFound)
- {
- Console.WriteLine();
- }
- else
- {
- Console.WriteLine("Nothing found");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement