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. for (int i = 1; i <= 12; i++) {
  13. Console.WriteLine("On the " + Days[i - 1] + " day of Christmas\nmy true love sent to me:");
  14. if (i == 12) {
  15. Console.WriteLine("12 Drummers Drumming");
  16. }
  17. if (i >= 11) {
  18. Console.WriteLine("11 Pipers Piping");
  19. }
  20. if (i >= 10) {
  21. Console.WriteLine("10 Lords a Leaping");
  22. }
  23. if (i >= 9) {
  24. Console.WriteLine("9 Ladies Dancing");
  25. }
  26. if (i >= 8) {
  27. Console.WriteLine("8 Maids a Milking");
  28. }
  29. if (i >= 7) {
  30. Console.WriteLine("7 Swans a Swimming");
  31. }
  32. if (i >= 6) {
  33. Console.WriteLine("6 Geese a Laying");
  34. }
  35. if (i >= 5) {
  36. Console.WriteLine("5 Golden Rings");
  37. }
  38. if (i >= 4) {
  39. Console.WriteLine("4 Calling Birds");
  40. }
  41. if (i >= 3) {
  42. Console.WriteLine("3 French Hens");
  43. }
  44. if (i >= 2) {
  45. Console.WriteLine("2 Turtle Doves");
  46. }
  47. if (i >= 1) {
  48. if (i == 1) {
  49. Console.WriteLine("1 Partridge in a Pear Tree\n");
  50. }
  51. else
  52. Console.WriteLine("and 1 Partridge in a Pear Tree\n");
  53. }
  54. }
  55. }
  56. }
  57. }
Success #stdin #stdout 0s 29672KB
stdin
Standard input is empty
stdout
On the first day of Christmas
my true love sent to me:
1 Partridge in a Pear Tree

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

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

On the fourth day of Christmas
my true love sent to me:
4 Calling Birds
3 French Hens
2 Turtle Doves
and 1 Partridge in a Pear Tree

On the fifth day of Christmas
my true love sent to me:
5 Golden Rings
4 Calling Birds
3 French Hens
2 Turtle Doves
and 1 Partridge in a Pear Tree

On the sixth day of Christmas
my true love sent to me:
6 Geese a Laying
5 Golden Rings
4 Calling Birds
3 French Hens
2 Turtle Doves
and 1 Partridge in a Pear Tree

On the seventh day of Christmas
my true love sent to me:
7 Swans a Swimming
6 Geese a Laying
5 Golden Rings
4 Calling Birds
3 French Hens
2 Turtle Doves
and 1 Partridge in a Pear Tree

On the eighth day of Christmas
my true love sent to me:
8 Maids a Milking
7 Swans a Swimming
6 Geese a Laying
5 Golden Rings
4 Calling Birds
3 French Hens
2 Turtle Doves
and 1 Partridge in a Pear Tree

On the ninth day of Christmas
my true love sent to me:
9 Ladies Dancing
8 Maids a Milking
7 Swans a Swimming
6 Geese a Laying
5 Golden Rings
4 Calling Birds
3 French Hens
2 Turtle Doves
and 1 Partridge in a Pear Tree

On the tenth day of Christmas
my true love sent to me:
10 Lords a Leaping
9 Ladies Dancing
8 Maids a Milking
7 Swans a Swimming
6 Geese a Laying
5 Golden Rings
4 Calling Birds
3 French Hens
2 Turtle Doves
and 1 Partridge in a Pear Tree

On the eleventh day of Christmas
my true love sent to me:
11 Pipers Piping
10 Lords a Leaping
9 Ladies Dancing
8 Maids a Milking
7 Swans a Swimming
6 Geese a Laying
5 Golden Rings
4 Calling Birds
3 French Hens
2 Turtle Doves
and 1 Partridge in a Pear Tree

On the twelveth day of Christmas
my true love sent to me:
12 Drummers Drumming
11 Pipers Piping
10 Lords a Leaping
9 Ladies Dancing
8 Maids a Milking
7 Swans a Swimming
6 Geese a Laying
5 Golden Rings
4 Calling Birds
3 French Hens
2 Turtle Doves
and 1 Partridge in a Pear Tree