adding data in different date ranges

Oct 19 2008 6:55 AM

hi all,

my problem is i have data like below(dates are in dd\mm\yyyy format)


start_date end_date fruits_eaten per_day_fruit_eaten

5/5/2008 14/5/2008 40 40/10 = 4
12/5/2008 21/5/2008 30 30/10 = 3
20/5/2008 30/5/208 55 55/11 = 5


i want to calculate above data like below

for the dates between 10/5/2008 and 25/5/2008 total fruits eaten are :

10/5/2008 = 4
11/5/2008 = 4
12/5/2008 = 4 + 3
13/5/2008 = 4 + 3
14/5/2008 = 4 + 3
15/5/2008 = 3
16/5/2008 = 3
17/5/2008 = 3
18/5/2008 = 3
19/5/2008 = 3
20/5/2008 = 3 + 5
21/5/2008 = 3 + 5
22/5/2008 = 5
23/5/2008 = 5
24/5/2008 = 5
25/5/2008 = 5


please help me solve this puzzle as it is driving me nuts !! i want to solve it in c# but logics are also welcomed

thanks in advance !


Answers (1)