public class DatesDifferenceInDays
{   public static void main(String args[])
    {   int d1=1, m1=10, y1=2003; //input date 1
        int d2=1, m2=10, y2=2004; //input date 2
        int daysInMonth[]={0, 31,28,31,30,31,30, 31,31,30,31,30,31};
        if(y1%400==0 || (y1%100!=0 && y1%4==0)) daysInMonth[2]=29;
        int days=0;
        while( !( d1==d2 && m1==m2 && y1==y2 ))
        {   days++;
            d1++;
            if(d1>daysInMonth[m1])
            {   m1++;
                d1=1;
                if(m1>12)
                {   y1++;
                    if(y1%400==0 || (y1%100!=0 && y1%4==0)) daysInMonth[2]=29;
                    else daysInMonth[2]=28;
                    m1=1;
                }
            }
        }//while
        System.out.println("No of days elapsed = "+days);
    }//daysBet2Dates
}//class

