summing number of days between 2 months

I'm stuck with a homework question - familiar story.

I must write a function that sums the total number of days from beggining of first argument (month 1) to the end of second argument (month2).

Have started off with a pair of if/elses to find number of days in month1 and month2 and summed them. Easy.

But can anyone help me find the sum of the days in the months inbetween? So I can add this to the sum of the two months in question.

Am i going about this totally the wrong way? It seems like the only way to do this is to program loads of if else's, surely theres a quicker way?

Any help most appreciated,

Johnny