Creating a Calendar Month

Hello All:

I am very new to this stuff but I wanted to try this out since I'll be doing this next semester.

It says that I need to print a calendar month using for loops. The program should prompt the user for the start day of the month (Sunday is 0, Monday is 1…Saturday is 6) and the number of days in the month.

I'm pretty sure that I can get the prompts to work but what about creating something that looks like this:

Sun Mon Tue Wed Thu Fri Sat
--- --- --- --- --- --- ---
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28

Press any key to continue . . .
Last edited on
good idea to skip wed,thu and fri in the first week of your month. i always hated them. :D

so what i would do is this:
1) print
 
mon tue wed thu fri sat sun

2) make two loops to print the numbers of the days, just like this:
1
2
3
4
5
6
7
8
9
for(int i = 1; i <= mumber_of_days; i++)
{
    for(int j = 0; j < 7; j++)
    {
         printf("%d ",i);
         i++;
     }
     printf("\n");
}

but be sure to print some space first in the first week dependent to the start day of the month
Oh no!! I'm sorry, I didn't realize that the data was aligned to the left. The first of the month was on Thursday!!
Topic archived. No new replies allowed.