Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _5._Seats
- {
- class Program
- {
- static void Main()
- {
- int numOfTickets = int.Parse(Console.ReadLine());
- for (int i = 1; i <= numOfTickets; i++)
- {
- string ticket = Console.ReadLine();
- int ticketToNum = int.Parse(ticket.ToString());
- char firstDigit = ticket[0];
- char secondDigit = ticket[1];
- char thirdDigit = ticket[2];
- char fourthDigit = ticket[3];
- bool condition = firstDigit >= 'A' && firstDigit <= 'Z';
- if (numOfTickets == 4)
- {
- if (condition)
- {
- Console.WriteLine($"Seat decoded: {firstDigit}{secondDigit}{thirdDigit}");
- }
- else
- {
- Console.WriteLine($"Seat decoded: {fourthDigit}{secondDigit}{thirdDigit}");
- }
- }
- else if (numOfTickets == 5 || numOfTickets == 6)
- {
- //char digit = char.Parse(secondDigit.ToString());
- char ASCIIDigit = (char)secondDigit;
- Console.WriteLine($"Seat decoded: {firstDigit}{ASCIIDigit}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement