>>can anybody help me to write the following program
Yes someone here will help you but you first have to post your code and ask questions about what you don't understand. We will not write the program for you.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
First declare three integers -- day, month and year. Then call scanf() to get user keyboard input. Finally call printf() to display the day.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
>>print the day of it. That's what happens when you try to paraphrase the assignment.
I misunderstood that -- I did not realize it meant the day of the week.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Can you use the standard library for this exercise. If so, look into mktime and localtime .
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
In general, you have to assign a specific date to be your ultimate beginning date. Then you calculate the exact number of days from that day to the day entered by the user. Then you can calculate the day-of-the-week from that value using the modulus (%) operator.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944