aggressiveviking

Untitled

Feb 19th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 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 seats = int.Parse(Console.ReadLine());
  12.             int total = 0;
  13.            
  14.             for (char i = 'A'; i <= sector; i++)
  15.             {
  16.                 for (int j = 1; j <= rows; j++)
  17.                 {
  18.                     if (j % 2 == 1)
  19.                     {
  20.                         for (int k = 1; k <= seats; k++)
  21.                         {
  22.                             Console.WriteLine($"{i}{j}{(char)(k + 96)}");
  23.                             total++;
  24.                         }
  25.                     }
  26.  
  27.                     else if (j % 2 == 0)
  28.                     {
  29.                         for (int k = 1; k <= seats + 2; k++)
  30.                         {
  31.                             Console.WriteLine($"{i}{j}{(char)(k + 96)}");
  32.                             total++;
  33.                         }
  34.                     }
  35.                 }
  36.                 rows++;
  37.             }
  38.             Console.WriteLine(total);
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment