Advertisement
Niicksana

Lucky Numbers

Dec 3rd, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Lucy_number
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double n = double.Parse(Console.ReadLine());
  14.             for (int num1 = 1; num1 <= 9; num1++)
  15.             {
  16.                 for (int num2 = 1; num2 <= 9; num2++)
  17.                 {
  18.                     for (int num3 = 1; num3 <= 9; num3++)
  19.                     {
  20.                         for (int num4 = 1; num4 <= 9; num4++)
  21.                         {
  22.                             if ((num1 + num2) == (num3 + num4) && n % (num1 + num2) == 0)
  23.                             {
  24.                                 Console.Write("{0}{1}{2}{3}", num1, num2, num3, num4);
  25.                                 Console.Write(" ");
  26.                             }
  27.                         }
  28.                     }
  29.                 }
  30.             }
  31.             Console.WriteLine();
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement