title: 12 Days Of Christmas C Program in Functions
body: <p>A C program that contains a function that outputs the lyrics of the traditional Christmas song “Twelve Days of Christmas.” Do not print the entire lyrics manually.</p>
  
  <p>So I made a code and there were errors but I finally fixed it. My Twelve Days of Christmas Song prints well with the looping.</p>
  
  <p>But I have another problem. Is my code possible to be separated or dissected as functions?</p>
  
  <p>The instruction says, "Your function will just be invoked in the main() function and will not return anything." So I guess I'll be using void? In what way?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;conio.h&gt;
  
  int main() // Main Function
  {
  int days, counter, num;
  
  printf("\n\t\t* * * TWELVE DAYS OF CHRISTMAS * * *\n");
  printf("\t\t_____________________________________\n\n\n");
  
  for (counter=1; counter&lt;=12; counter++) {
  
  printf("\tOn the ");
  
  switch(counter){
          case 1:
              printf("1st");
              break;
          case 2:
              printf("2nd");
              break;
          case 3:
              printf("3rd");
              break;
          default:
              printf("%dth", counter);
              break;
      }
  printf(" day of Christmas my true love sent to me\n\n");
  
  switch(counter) {
  
      case 12: printf("\t\tTwelve Drummers Drumming\n\n");
      case 11: printf("\t\tEleven Pipers Piping\n\n"); 
      case 10: printf("\t\tTen Lords a Leaping\n\n");
      case 9: printf("\t\tNine Ladies Dancing\n\n"); 
      case 8: printf("\t\tEight Maids a Milking\n\n");
      case 7: printf("\t\tSeven Swans a Swimming\n\n");
      case 6: printf("\t\tSix Geese a Laying\n\n"); 
      case 5: printf("\t\tFive Golden Rings\n\n"); 
      case 4: printf("\t\tFour Calling Birds \n\n"); 
      case 3: printf("\t\tThree French Hens\n\n");
      case 2: printf("\t\tTwo Turtle Doves\n\n");
      case 1: printf("\t\t");if (counter &gt; 1 ) printf("And ");printf("A Partridge in a Pear Tree\n\n");
      //  case 1: printf("\t\tA Partridge in a Pear Tree\n\n");
  
  
  
  }
  
  }
  
  getchar(); return 0; }
  </code></pre>
  
  <p>Tried executing this and works fine with the printing. Do you have any suggestions to imporove my code? Having trouble with functions.</p>