i have a question about the logic about the calendar question. I have to make a calendar, so user inputs a month (number 1-12) and a date, and the output is suppose to be: Friday, January 1, 2010. Suppose to be written in just simple c, no arrays or anything, only while or like for loops and stuff. I got it done and everything works fine, but the code is like 550 lines. my logic is as follows

input month m

input date n

then if checks if m==1, then it goes to while date>=1 (coz i only did for the days for the first week so if n=1 - then its monday, else if 2-tuesday......else if 7-sunday; break; ), and if 29 entered, at the end of the loop "else n=n-7" so it goes down by 7 untill it reaches the 1-7 numbers..

so exact the same thing for the next 11 months of 2010, the only problem is the every month starts with a different day of the week, theres like 2 or 3 month start with the same day, so i did if n==1 || n==3 then the days of the week as follows..

so my question is there any shorter way to do it?

thanks in advance

0

*Edited
by Unidennn*: n/a