VanessaShopping

Untitled

Jun 18th, 2016
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 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 IncreasingFourNumbers
  8. {
  9.     class IncreasingFourNumbers
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int a = int.Parse(Console.ReadLine());
  14.             int b = int.Parse(Console.ReadLine());
  15.             if (b - a >= 3)
  16.             {
  17.                 for (int n1 = a; n1 <= b; n1++)
  18.                 {
  19.                     for (int n2 = n1 + 1; n2 <= b; n2++)
  20.                     {
  21.                         for (int n3 = n2 + 1; n3 <= b; n3++)
  22.                         {
  23.                             for (int n4 = n3 + 1; n4 <= b; n4++)
  24.                             {
  25.                                 Console.WriteLine("{0}", n1);
  26.                                 Console.WriteLine("{0}", n2);
  27.                                 Console.WriteLine("{0}", n3);
  28.                                 Console.WriteLine("{0}", n4);
  29.                             }
  30.                         }
  31.                     }
  32.                 }
  33.             }
  34.             else
  35.             {
  36.                 Console.WriteLine("No");
  37.             }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment