please run this program and take year 2201 and see the result. the day will be one day ahead of the actual day, if take year 2500 the day will 6 days ahead of the actual day or more.
that's ist the problem. 2. i want user to enter full date like 02-02-2205 ok. how my program will read it. 3. how to subtract ( entered date - system date) or date like 01-01-1900 that i intialised in this programm. regards nilesh --- In [email protected], "Tyler Littlefield" <ty...@...> wrote: > > what about the ladies on this list? sir is rather catigorical, wouldn't you > say? > I have no idea what you wanted to do within that comment block, but I made no > sense out of what you just said. > If you want to enter days, you need to calculate the length of each month. If > the year is evenly divisible by 4, then feb==29 days. Then take the current > date, calculate how many days ahead you are into the year, and 365-d is how > many days until January First. > > Thanks, > Tyler Littlefield > Web: tysdomain.com > email: ty...@... > My programs don't have bugs, they're called randomly added features. > > ----- Original Message ----- > From: real > To: [email protected] > Sent: Wednesday, March 04, 2009 10:08 PM > Subject: [c-prog] Please Help/* PROGRAMME FOR FINDING DAY OF 1ST JANUARY OF > THE YEAR*/ > > > > Sir, > > Plese help. > > Regards > > Nilesh > > #include "stdio.h" > > main() > { > /* PROGRAMME FOR FINDING DAY OF 1ST JANUARY OF THE YEAR*/ > > > /*ITS WORK UP TO YEAR 1900 TO 2200 ONLY AFTER THAT > > IT'S FAIL TO GIVE THE ACCURATE DAY > > WANTS TO ENTER DATE LIKE 01-02-1996 AND FIND THE > > DAY . PROBLEM IS HOW TO ENTER DATE LIKE THIS AND FIND DAY NUMBER > > OF DAYS . PLEASE HELP. > > */ > > int year,noy, leapyear, nod,b, day; > > > > printf( " Enter Year to get day of 1st jan "); > > scanf("%d",&year); > > /* for getting no of days*/ > > noy = year - 1900; > printf( "\n number of year = %d ",noy ); > > leapyear = (noy-1)/4+1; > printf( "\n no of leap year = %d ",leapyear ); > > > if ( year >2100) > { > nod = noy*365+leapyear; > } > else > { > > > nod = noy*365+leapyear+1; > } > > > printf( "\n no of day = %d ",nod ); > > day = nod%7; > printf("\n day of the week = %d ",day ); > b = nod/7; > > printf( "\n quotient day = %d ",b ); > if ( noy < 1) > { > printf ( "\n sunday "); > } > else > { > if (day<1) > { > printf ( "\n saturday "); > } > > > else > { > if (day >5) > { > printf ( " \n friday " ); > } > else > { > if (day >4) > { > printf ( "\n thursday "); > } > else > { > if (day >3) > { > printf ( "\n wednesday "); > } > else > { > if (day >2) > { > printf ( "\n tuesday "); > } > else > { > if (day >1) > { > printf ( "\n monday "); > } > else > { > printf ( "\n sunday "); > } > } > } > } > } > } > > } > } > > > > > > [Non-text portions of this message have been removed] >
