Venciity

[ Telerik C#] LOOPS - EX 11

Feb 13th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. // 11. Write a program that prints all possible cards from a standard deck of 52 cards (without jokers).
  2. // The cards should be printed with their English names. Use nested for loops and switch-case.
  3.  
  4. using System;
  5.  
  6. namespace ex10
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             string[] ranks = { "Ace", "Two", "Three", "Four", "Five", "Six", "Seven",
  13.                              "Eight", "Nine", "Ten", "Jack", "Queen", "King" };
  14.  
  15.             string[] colors = { "Clubs", "Diamonds", "Hearts", "Spades" };
  16.  
  17.             foreach (var rank in ranks)
  18.             {
  19.                 foreach (var color in colors)
  20.                 {
  21.                     Console.WriteLine("{0} of {1}", rank, color);
  22.                 }
  23.             }
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment