fork(1) download
  1. #include <stdio.h>
  2.  
  3. // Function Implementation
  4. void yourFunction(void)
  5. {
  6. int days, counter, num;
  7.  
  8. printf("\n\t\t* * * TWELVE DAYS OF CHRISTMAS * * *\n");
  9. printf("\t\t_____________________________________\n\n\n");
  10.  
  11. for (counter=1; counter<=12; counter++) {
  12.  
  13. printf("\tOn the ");
  14.  
  15. switch(counter){
  16. case 1:
  17. printf("1st");
  18. break;
  19. case 2:
  20. printf("2nd");
  21. break;
  22. case 3:
  23. printf("3rd");
  24. break;
  25. default:
  26. printf("%dth", counter);
  27. break;
  28. }
  29. printf(" day of Christmas my true love sent to me\n\n");
  30.  
  31. switch(counter) {
  32.  
  33. case 12: printf("\t\tTwelve Drummers Drumming\n\n");
  34. case 11: printf("\t\tEleven Pipers Piping\n\n");
  35. case 10: printf("\t\tTen Lords a Leaping\n\n");
  36. case 9: printf("\t\tNine Ladies Dancing\n\n");
  37. case 8: printf("\t\tEight Maids a Milking\n\n");
  38. case 7: printf("\t\tSeven Swans a Swimming\n\n");
  39. case 6: printf("\t\tSix Geese a Laying\n\n");
  40. case 5: printf("\t\tFive Golden Rings\n\n");
  41. case 4: printf("\t\tFour Calling Birds \n\n");
  42. case 3: printf("\t\tThree French Hens\n\n");
  43. case 2: printf("\t\tTwo Turtle Doves\n\n");
  44. case 1: printf("\t\t");if (counter > 1 ) printf("And ");printf("A Partridge in a Pear Tree\n\n");
  45. // case 1: printf("\t\tA Partridge in a Pear Tree\n\n");
  46. }
  47. }
  48. }
  49.  
  50. int main()
  51. {
  52. yourFunction(); // Call your function
  53. return 0;
  54. }
  55.  
Success #stdin #stdout 0s 2252KB
stdin
Standard input is empty
stdout
		* * * TWELVE DAYS OF CHRISTMAS * * *
		_____________________________________


	On the 1st day of Christmas my true love sent to me

		A Partridge in a Pear Tree

	On the 2nd day of Christmas my true love sent to me

		Two Turtle Doves

		And A Partridge in a Pear Tree

	On the 3rd day of Christmas my true love sent to me

		Three French Hens

		Two Turtle Doves

		And A Partridge in a Pear Tree

	On the 4th 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 5th 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 6th 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 7th 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 8th 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 9th 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 10th 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 11th 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 12th 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