Challenge from Harsh

harsh_illusion's Avatar, Join Date: Jul 2004
Newbie Member
HI FRNds !

here's a good one for those having interest in C .
Q: create a program to find the Day for any Date of ny Month and ny Year(ny means it can also be 0 or more than 9999) and then after displaying the day the user can browse whole calender ( consequtive months from up & down arrow keys and consequtive Years from left and right arrow keys.)

CONDITION: The Program must be in "Text" mode and the amount of code lines used should be "MINIMUM". Also for representing months and years "strings " should be used not like using 1 to 12 for displaying all the months !

alok's Avatar
Ambitious contributor
hain r u in school or want to complete the college project.
what type of Challenege is this.
hain any way we can try your challenge.tell me the time limit
xpi0t0s's Avatar, Join Date: Aug 2004
Impossible to answer in its current form.

Year 0 didn't exist. So if it has 365 or 366 days, it will mess up the order of days in BC or AD depending which way you're doing the calculation.

If it has 364 days, which is an exact multiple of 7, then it might work, but you'll need to find out what month has one fewer day than normal. Will February have 27 days, or will another month be reduced?

The current calendar has only been in force for the last few hundred years. Projecting back before then is a bit pointless (although I suppose means it could print anything without technically being "incorrect")

Actually this "challenge" is a piece of cake. Simply take a known day (e.g. today, Friday Aug 6), convert that into a number of days (doesn't really matter from when), convert your required day into a number of days, subtract it from the known day and take the remainder after dividing by 7. Subtract the result from the number for Friday (e.g. 6), mod the result by 7 and that gives you the day number, which you can convert back into a day name.

So if you pick a day 3503 days from now, that's 500*7+3, and about 10 years, that's clearly going to be a Monday.
elec.shabnam's Avatar, Join Date: Feb 2008
Ambitious contributor
i feel this is a real good challenge for students like me ,to increase our ability