Advertisement
Guest User

Untitled

a guest
Jun 28th, 2018
121
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.  
  3. internal class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         int start = int.Parse(Console.ReadLine());
  8.         int end = int.Parse(Console.ReadLine());
  9.  
  10.         for (int first = start; first <= end; first++)
  11.         {
  12.             for (int second = start; second <= end; second++)
  13.             {
  14.                 for (int third = start; third <= end; third++)
  15.                 {
  16.                     for (int forth = start; forth <= end; forth++)
  17.                     {
  18.                         bool oddEven = (first % 2 == 0 && forth % 2 != 0) || (first % 2 != 0 && forth % 2 == 0);
  19.                         bool biggerFirst = first > forth;
  20.                         bool evenSum = (second + third) % 2 == 0;
  21.  
  22.                         if (oddEven && biggerFirst && evenSum)
  23.                         {
  24.                             Console.Write($"{first}{second}{third}{forth} ");
  25.                         }
  26.                     }
  27.                 }
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement