Advertisement
Guest User

Untitled

a guest
Aug 18th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.58 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _7._Print_Deck_of_Cards
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string card = Console.ReadLine();
  10.  
  11.             int cardNum;
  12.             if (card == "A")
  13.             {
  14.                 cardNum = 14;
  15.             }
  16.             else if (card == "K")
  17.             {
  18.                 cardNum = 13;
  19.             }
  20.             else if (card == "Q")
  21.             {
  22.                 cardNum = 12;
  23.             }
  24.             else if (card == "J")
  25.             {
  26.                 cardNum = 11;
  27.             }
  28.             else
  29.             {
  30.                 cardNum = int.Parse(card);
  31.             }
  32.  
  33.             for (int i = 0; i < cardNum - 1; i++)
  34.             {
  35.                 if (i == 9)
  36.                 {
  37.                     Console.WriteLine("J of spades, J of clubs, J of hearts, J diamonds");
  38.                 }
  39.                 else if (i == 10)
  40.                 {
  41.                     Console.WriteLine("Q of spades, Q of clubs, Q of hearts, Q diamonds");
  42.                 }
  43.                 else if (i == 11)
  44.                 {
  45.                     Console.WriteLine("K of spades, K of clubs, K of hearts, K diamonds");
  46.                 }
  47.                 else if (i == 12)
  48.                 {
  49.                     Console.WriteLine("A of spades, A of clubs, A of hearts, A diamonds");
  50.                 }
  51.                 else
  52.                 {
  53.                     Console.WriteLine($"{i + 2} of spades, {i + 2} of clubs, {i + 2} of hearts, {i + 2} diamonds");
  54.                 }
  55.             }
  56.         }
  57.     }
  58. }
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement