Question: C Code - Recursion Skeleton Code: /********************************************************** Program: presents.c ************************************************************/ #include ??? present_on_day(???); ??? present_thru_days(???); // The main program is called with an integer argument

C Code - Recursion

C Code - Recursion Skeleton Code: /********************************************************** Program: presents.c ************************************************************/ #include ???

present_on_day(???); ??? present_thru_days(???); // The main program is called with an integer

Skeleton Code:

/********************************************************** Program: presents.c ************************************************************/ #include  ??? present_on_day(???); ??? present_thru_days(???); // The main program is called with an integer argument // denoting the "n-th" day on which the number of presents // will be determined. int main(void) { int n; printf("Please enter the number of days: "); scanf("%d", &n); printf("You have entered the number of days as: %d ", n); if (n == 1) { printf("The number of present received on day 1 is %d. ", ???); printf("The number of present received in 1 day is %d. ", ???); } else { // Here, n > 1 printf("The number of presents received on day %d is %d. ", n, ???); printf("The number of presents received in %d days is %d. ", n, ???); } return 0; } // This function determines the number of presents to be received // on the n-th day. // Pre-condition: n >= 1 ??? present_on_day(???) { } // This function determines the number of presents to be received // throughout n days. // Pre-condition: n >= 1 ??? present_thru_days(???) { } 

Practice S10P05: Christmas Presents http://www.comp.nus.edu.sg/cs1010/4 misc/practice.html Week of release: Week 10 Objective: Recursiorn Task statement: The following lyric is extracted from the Christmas song "The Twelve Days of Christmas": 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. Going by this logic, write a recursive function present on day(n) to determine the number of presents to receive from your true love in day n, for 00). Write a recursive function present thru days(n) to compute this answer Your program will read a positive integer, which is the day/the number of days of interest Following are some sample runs, in which the underlined blue numbers are the input

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!