Code:
int months[] = {
31, // January
28, // Feb
31, // Mar
30, // April
31, // May
30, // Jun
31, // July
31, // Aug
30, // Sep
31, // Oct
30, // Nov
31 // Dec
}
int main()
{
int start_month = 1; // January
int end_month = 6; // June
int year = 2004; // needed for leap-year check
int m, total;
// there are some other leap-year conditions too, but this
// is sufficient for most purposes.
if( (year % 4) == 0)
months[1] = 29; // make February 29 days
// arrays are indexed from 0-11 so subtract one from each month
total = 0;
for(m = start_month-1; m < end_moth; m++)
total += months[m];
}
[edit]
so i expect they're looking for an array free solution.
Sorry, I didn't notice that when I first posted this.
[/dit]