How do I change my code so that it lists month name instead of only the month number

A cleaner way than switch/if/else, create a lookup table to store the month names:

 static char * monthNames[12] = {"January","February",..etc..};

change the printf to use the month value as an index into the string array. Note that arrays are indexed starting at 0, so you have to decrement the month by one to get the correct index.

printf("The date entered is %d. %s %d. \n", day, monthNames[month-1], year);

As an alternative to the array approach, you can write a function that returns a pointer to the name of the correct month, using a switch statement/lookup table like you mentioned in your comment:

const char* getMonthName(int month)
{
  switch(month)
  {
    case 1: return "January";
    case 2: return "February";
    // ...
    case 12: return "December";
    default: return "Unknown";
  }
}

Then you can call it in main:

printf("The date entered is %d. %s %d. \n", day, getMonthName(month), year);

A few notes about this approach:

  1. Each month name string defined in getMonthName is a string literal. These are most often placed in read only memory of the executable, and you invoke undefined behavior if you try to modify them. Since I've made getMonthName return a const char*, You should at least get some support from the compiler in the form of a warning or error if you try to do something you shouldn't. In general, be careful returning strings (more generally, arrays) from functions. You cannot return local arrays from functions, as they go out of scope when the function returns, and the pointer that is returned now points to invalid data. Since these string literals are not local to getMonthName, you're safe to return a pointer to them.

  2. Some coding standards require one return statement per function. I have yet to hear a good reason for that, but if that's your case, you can easily modify this to set a pointer to the appropriate string, then return that pointer.

  3. This is clearly more code, but one advantage of this approach vs the raw array is this function has built-in bounds protection. You already correctly check that month is within bounds, but that check will always need to accompany array access anywhere in your code. In fact, best practice is to encapsulate bounds checking and month name retrieval in a function, no matter whether you use an array or a switch statement. That way, you just have a single function call to get the month name and you can be assured even bogus inputs won't invoke UB.