Advertisement
aggressiveviking

Untitled

Feb 19th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _06.WeddingSeats
  4. {
  5.     class WeddingSeats
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             char sector = char.Parse(Console.ReadLine());
  10.             int rows = int.Parse(Console.ReadLine());
  11.             int oddPlaces = int.Parse(Console.ReadLine());
  12.            
  13.             int count = 0;
  14.  
  15.             for (int i = 'A'; i <= sector; i++)
  16.             {
  17.                 for (int j = 0; j < rows; j++)
  18.                 {
  19.                     if (rows % 2 == 1)
  20.                     {
  21.                         for (int k = 97; k < 97 + oddPlaces; k++)
  22.                         {
  23.                             Console.WriteLine($"{(char)i}{j}{(char)(k + 96)}");
  24.                             count++;
  25.                         }
  26.                     }
  27.                     else if (rows % 2 == 0)
  28.                     {
  29.                         for (int k = 97; k < 97 + oddPlaces + 2; k++)
  30.                         {
  31.                             Console.WriteLine($"{(char)i}{j}{(char)(k + 96)}");
  32.                             count++;
  33.                         }
  34.                     }
  35.                 }
  36.                 rows++;
  37.             }
  38.             Console.WriteLine($"{count}");
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement