Calender
Calender
EDUCATION
BHANDUP(W)
MICRO PROJECT
Seal of Institute
Branch:COMPUTER ENGINEERING
Name of Microproject:Academic Calender
Academic Calender
Part A
1. Introduction:
This program is a calendar program written in C language. It takes input of
a year from the user and determines the day code for the first day of that year using the
Sakamoto's Algorithm. It then determines if the year is a leap year or not, and adjusts
the number of days in February accordingly. Finally, it displays a calendar for the entire
year, showing all the months and their corresponding dates. The calendar is displayed
on the console with the days of the week arranged in columns, starting from Sunday and
ending on Saturday. The program makes use of arrays to store the number of days in
each month and the names of the months. It also uses loops to iterate through the
months and days of each month, and conditional statements to determine the correct
position of each date on the calendar. Overall, this program can be a useful tool for
displaying a yearly calendar in a clear and concise format.
Resources Required:
Sr. Name of Resource Suggested Broad Specification Quantity No
1.
2.
3.
4.
5.
6.
PartB
BRIEF INTRODUCTION
:-
The aim of this calendar program is to display a calendar for a given year,
showing the days of the week for each month.
The program determines the day
code for the first day of the year, whether the year is a leap year or not, and then
prints out a calendar for each month of the year, including the days of the week
and the dates for each day. The user is prompted to enter a year, and the program
uses this year as input for generating the calendar. The output is a neatly
formatted calendar that can be printed out and used for planning or scheduling
events.
Input:
#include<stdio.h>
#define TRUE 1
#define FALSE 0
int days_in_month[]={0,31,28,31,30,31,30,31,31,30
,31,30,31};
char *months[]=
{
" ",
"\n\n\nJanuary",
"\n\n\nFebruary",
"\n\n\nMarch",
"\n\n\nApril",
"\n\n\nMay",
"\n\n\nJune",
"\n\n\nJuly",
"\n\n\nAugust",
"\n\n\nSeptember",
"\n\n\nOctober",
"\n\n\nNovember",
"\n\n\nDecember"
};
int inputye
ar(void)
{
int year;
int main(void)
{
int year, daycode, leapyear;
year = inputyear();
daycode = determinedaycode(year);
determineleapyear(year);
calendar(year, daycode);
printf("\n");
}
Output:
Explanation:
To begin, we'll create two arrays: one with the number of days in each month, and
another with all of the month
es.nam
Note that the first position in both arrays is
intentionally left empty; we want to keep things simple by using 1 to 12.
The following method,determinedaycode), is( used to get the day number of the first
day of that year, allowing us to display the date in the proper location. (As a result, it's
just utilized for outp
ut.)
Thedetermineleapyear ) method
( is used to see whether the user's input is a leap year. If
this is the case, the number of days in February is increased to 29.
Each month is printed on the screen using the final function calendar(). To loop across
all months, use the first for loop. The month's name and all of the days of the week are
then printed. The daycode is then used to place the prompt under the correct weekday.
Then we print a month's worth of dates. The final step is to place the
e prompt in th
proper weekday position.