Advertisement
silvana1303

challenge the wedding

Apr 20th, 2020
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 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 men = int.Parse(Console.ReadLine());
  10.             int women = int.Parse(Console.ReadLine());
  11.             int tableMax = int.Parse(Console.ReadLine());
  12.             int tableCounter = 0;
  13.  
  14.             for (int m = 1; m <= men; m++)
  15.             {
  16.                 for (int f = 1; f <= women; f++)
  17.                 {
  18.                     Console.Write("({0} <-> {1}) ", m, f);
  19.                     tableCounter++;
  20.                     if (tableCounter == tableMax)
  21.                     {
  22.                         return;
  23.                     }
  24.                 }
  25.             }
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement