fork download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace DailyChallenge296 {
  5. class Program {
  6.  
  7. static void Main()
  8. {
  9. var Days = new List<string> { "first", "second", "third", "fourth", "fifth", "sixth",
  10. "seventh", "eighth", "ninth", "tenth", "eleventh", "twelveth" };
  11.  
  12. var Gifts = new List<string> { "a Partridge in a Pear Tree", "two Turtle Doves",
  13. "three French Hens", "four Calling Birds", "five Golden Rings",
  14. "six Geese a Laying", "seven Swans a Swimming", "eight Maids a Milking",
  15. "nine Ladies Dancing", "ten Lords a Leaping", "eleven Pipers Piping",
  16. "twelve Drummers Drumming" };
  17.  
  18. for (int i = 0; i < 12; i++) {
  19. Console.WriteLine("\nOn the {0} day of Christmas\nmy true love sent to me:", Days[i]);
  20. for (int j = i; j >= 0; j--) {
  21. if (i > 0)
  22. Gifts[0] = "and a Partridge in a Pear Tree";
  23. else
  24. Gifts[0] = "a Partridge in a Pear Tree";
  25. Console.WriteLine(Gifts[j]);
  26. }
  27. }
  28. Console.ReadLine();
  29. }
  30. }
  31. }
Success #stdin #stdout 0s 29672KB
stdin
Standard input is empty
stdout
On the first day of Christmas
my true love sent to me:
a Partridge in a Pear Tree

On the second day of Christmas
my true love sent to me:
two Turtle Doves
and a Partridge in a Pear Tree

On the third day of Christmas
my true love sent to me:
three French Hens
two Turtle Doves
and a Partridge in a Pear Tree

On the fourth day of Christmas
my true love sent to me:
four Calling Birds
three French Hens
two Turtle Doves
and a Partridge in a Pear Tree

On the fifth day of Christmas
my true love sent to me:
five Golden Rings
four Calling Birds
three French Hens
two Turtle Doves
and a Partridge in a Pear Tree

On the sixth day of Christmas
my true love sent to me:
six Geese a Laying
five Golden Rings
four Calling Birds
three French Hens
two Turtle Doves
and a Partridge in a Pear Tree

On the seventh day of Christmas
my true love sent to me:
seven Swans a Swimming
six Geese a Laying
five Golden Rings
four Calling Birds
three French Hens
two Turtle Doves
and a Partridge in a Pear Tree

On the eighth day of Christmas
my true love sent to me:
eight Maids a Milking
seven Swans a Swimming
six Geese a Laying
five Golden Rings
four Calling Birds
three French Hens
two Turtle Doves
and a Partridge in a Pear Tree

On the ninth day of Christmas
my true love sent to me:
nine Ladies Dancing
eight Maids a Milking
seven Swans a Swimming
six Geese a Laying
five Golden Rings
four Calling Birds
three French Hens
two Turtle Doves
and a Partridge in a Pear Tree

On the tenth day of Christmas
my true love sent to me:
ten Lords a Leaping
nine Ladies Dancing
eight Maids a Milking
seven Swans a Swimming
six Geese a Laying
five Golden Rings
four Calling Birds
three French Hens
two Turtle Doves
and a Partridge in a Pear Tree

On the eleventh day of Christmas
my true love sent to me:
eleven Pipers Piping
ten Lords a Leaping
nine Ladies Dancing
eight Maids a Milking
seven Swans a Swimming
six Geese a Laying
five Golden Rings
four Calling Birds
three French Hens
two Turtle Doves
and a Partridge in a Pear Tree

On the twelveth day of Christmas
my true love sent to me:
twelve Drummers Drumming
eleven Pipers Piping
ten Lords a Leaping
nine Ladies Dancing
eight Maids a Milking
seven Swans a Swimming
six Geese a Laying
five Golden Rings
four Calling Birds
three French Hens
two Turtle Doves
and a Partridge in a Pear Tree