Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _05._Winner_Tickets
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- //{цифра на хилядните}{цифра на стотиците}{цифра на десетици}{цифра на единици}
- //всички числа от 1111 до 9999 -> проверка дали е печеливш -> принтираме
- for (int hil = 1; hil <= 9; hil++)
- {
- for (int stot = 1; stot <= 9; stot++)
- {
- for (int des = 1; des <= 9; des++)
- {
- for (int ed = 1; ed <= 9; ed++)
- {
- int sumFirst = hil + stot;
- int sumLast = des + ed;
- if (sumFirst == sumLast && n % sumFirst == 0)
- {
- Console.Write($"{hil}{stot}{des}{ed} ");
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement