Advertisement
VyaraG

CheckCardForAPlay

Nov 29th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System;
  2.  
  3. //Classical play cards use the following signs to designate the card face: 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K and A. Write a program that enters a string and prints β€œyes” if it is a valid card sign or β€œno” otherwise.
  4.  
  5. class CheckCardForAPlay
  6. {
  7.     static void Main()
  8.     {
  9.         Console.Write ("Enter a card: ");
  10.         string enterACard = Console.ReadLine();
  11.         switch (enterACard)
  12.         {
  13.             case "2":
  14.             case "3":
  15.             case "4":
  16.             case "5":
  17.             case "6":
  18.             case "7":
  19.             case "8":
  20.             case "9":
  21.             case "10":
  22.             case "J":
  23.             case "Q":
  24.             case "K":
  25.             case "A":
  26.                 Console.WriteLine("yes");
  27.                 break;
  28.  
  29.             default: Console.WriteLine("no");
  30.                 break;
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement