VOOZH about

URL: https://www.geeksforgeeks.org/c/c-program-to-display-month-by-month-calendar-for-a-given-year/

⇱ C program to display month by month calendar for a given year - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C program to display month by month calendar for a given year

Last Updated : 12 Jul, 2025

Prerequisite:Find day of the week for a given date Given a year N, the task is to print the calendar for every month of the given year. Implementation:


Output
... 17 18 19 20
 21 22 23 24 25 26 27
 28 29 30 31

 ------------September-------------
 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 29 30

 ------------October-------------
 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 29
 30 31

 ------------November-------------
 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 29 30

 ------------December-------------
 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 29 30 31

Time Complexity: O(1)
Auxiliary Space: O(1), As constant extra space is used.

Comment
Article Tags:
Article Tags: