I think I did it in about 5 lines in the end!!
I would be interested to see if anyone else can do it in about the same number of lines.
Hey Esbo, would this qualify?
Code:
#include <stdio.h>
unsigned long CalcDays(int iMonth, int iDay, int iYear)
{
return (iDay + (153 * (iMonth + 12 * ((14 - iMonth) / 12) - 3) + 2) / 5 + 365 *
(iYear + 4800 - ((14 - iMonth) / 12)) + (iYear + 4800 - ((14 - iMonth) / 12)) / 4 - 32083);
}
int main(void)
{
printf("%d\n", CalcDays(1, 17, 2008) - CalcDays(1, 03, 2008) );
return 0;
}