bacco

Щастливи числа

Feb 21st, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Купа
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.  
  11.             for (int one = 1; one <= 9; one++)
  12.             {
  13.                 for (int two = 1; two <= 9; two++)
  14.                 {
  15.                     for (int three = 1; three <= 9; three++)
  16.                     {
  17.                         for (int four = 1; four <= 9; four++)
  18.                         {
  19.                             if (one + two == three + four  && n % (one + two) == 0)
  20.                             {
  21.                                Console.Write($"{one}{two}{three}{four} ");
  22.                             }
  23.                         }
  24.                     }
  25.                 }
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment