silvana1303

lucky numbers

Apr 20th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using System;
  2.  
  3. namespace nestedloops
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.  
  11.             for (int a = 1; a <= 9; a++)
  12.             {
  13.                 for (int b = 1; b <= 9; b++)
  14.                 {
  15.                     for (int c = 1; c <= 9; c++)
  16.                     {
  17.                         for (int d = 1; d <= 9; d++)
  18.                         {
  19.                             if ( a + b == c + d && (n % (a+b) == 0))
  20.                             {
  21.                                 Console.Write("{0}{1}{2}{3} ", a, b, c, d);
  22.                             }
  23.                         }
  24.                     }
  25.                 }
  26.             }
  27.         }
  28.     }
  29. }
Add Comment
Please, Sign In to add comment