1. ## A challange

My teacher gave the whole class a challenge that
" Input date month and year and u have to find out the day of that given date . The year should be greater then 1800 " so any help he said you can take any help wether from friend google or anyone and if its done have to submit it in 6 hours so please help me out

3. Do you mean find out the days from month and year?

Well that's not too hard is it...

A year is 365 days. A month is usually 30 days. Of course you can be a bit specific by mapping certain months into a function that returns how many days.

4. So the user inputs a date, and the program tells the person what day that date is? Like, Friday or something?
If that's the purpose of it, then wouldn't it be crazy to go back to 1800?

5. yup time is running out and no clue how to do it from 1800 up till 2000

6. yup time is running out and no clue how to do it from 1800 up till 2000
Google using the term "lewis carroll algorithm"

7. Originally Posted by execute
A year is 365 days. A month is usually 30 days.
A year is about 365.25 days because every 4 years the days in a year are 366 instead of 365.
The number of days in a month are: 31, (28 or 29), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
So since 7/12 months are 31 days, I'd say a month is "usually" 31 days.

8. Originally Posted by cpjust
So since 7/12 months are 31 days, I'd say a month is "usually" 31 days.
I would say a month is about 30 days, since 365 / 12 ~= 30.42

9. Uh, challenge you say.. you could at least attempt it and show what you've got.

Some guy just posted something like that: New member just saying hi, along with my first question :)

10. Originally Posted by Elysia
I would say a month is about 30 days, since 365 / 12 ~= 30.42
365.25/12 = ~30.4375 on my calculator.
But I said "usually" which is like the mean number, not "about" which is like the average number.

11. You mean the mode, the most recurring number(s) in a series. The mean is the average.

12. Originally Posted by citizen
You mean the mode, the most recurring number(s) in a series. The mean is the average.
Gah, they are just different ways of computing an "average".

13. Originally Posted by citizen
You mean the mode, the most recurring number(s) in a series. The mean is the average.
Oops, that's right. Median is what I meant. Too many damn words to choose from.

Time's up. So, here's one possible solution...

Code:
```#include <stdio.h>
int DayOfWeek(int iYear, int iMonth, int iDay)
{
int iT[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
iYear -= iMonth < 3;
return (iYear + iYear/4 - iYear/100 + iYear/400 + iT[iMonth-1] + iDay) % 7;
}

int main(void)
{
char *pDay[] = {"Sunday", "Monday",
"Tuesday", "Wednesday",
"Thursday", "Friday",
"Saturday"};
printf("Day of week is %s\n",pDay[DayOfWeek(2008, 11, 16)]);
return 0;
}```