c program for printing the month of any year:-
code :-
//header files declaration
#include <stdio.h>
#include <stdlib.h>
//function declarations
int checkLeapYear( int year
);
long days( int y, int m, int d);
int leapYears( int year
);
int todayOf( int y, int m, int d);
void calendar(int y, int m);
//main function
int main(int argc, char* argv[]){
int year,month;
char choice;
while(1) {
printf("1. Print calendar of a
month\n");
printf("2. Exit\n");
printf("Enter your choice: ");
scanf("\n%c", &choice);
switch(choice)
{
case '1':
printf("Enter
the month and year: ");
scanf("%d %d",
&month, &year);
calendar(year,
month);
break;
case '2':
printf("Bye!!");
exit(0);
break;
default:
printf("Not a
valid option\n");
break;
}
}
return 0;
}
// to check year is leap or not?
int checkLeapYear( int z){
return(z % 400 == 0) || ((z % 4 == 0) &&
(z % 100 != 0));
}
//count how many leap years
int leapYears( int y ){
return y/4 - y/100 + y/400;
}
int todayOf( int y, int m, int d) {
static int DayOfMonth[] =
{
-1,0,31,59,90,120,151,181,212,243,273,304,334};
return DayOfMonth[m] + d + ((m>2 &&
checkLeapYear(y))? 1 : 0);
}
long days( int y, int m, int d){
int lastYear;
lastYear = y - 1;
return 365L * lastYear + leapYears(lastYear) +
todayOf(y,m,d);
}
// print calender format for the month
void calendar(int y, int m){
int len=0, j, flag1 = 0;
const char *NameOfMonth[] = {
NULL/*dummp*/,
"January", "February",
"March", "April", "May", "June",
"July", "August",
"September", "October", "November", "December"
};
char dayWeeks[]= "Su Mo
Tu We Th Fr
Sa";
int DayOfMonth[] =
{
-1,31,28,31,30,31,30,31,31,30,31,30,31 };
int weekOfTopDay;
int i,day;
weekOfTopDay = days(y, m, 1) % 7;
if(checkLeapYear(y))
DayOfMonth[2] =
29;
printf("\n %s %d\n%s\n",
NameOfMonth[m], y, dayWeeks);
for(i=0;i<weekOfTopDay;i++)
printf(" ");
for(i=weekOfTopDay,day=1;day <=
DayOfMonth[m];i++,day++){
flag1 = 0;
for (j = 0; j < len;
j++) {
printf("|%2d| ",day);
flag1 = 1;
}
if (flag1 == 0) {
printf("%2d ",day);
}
if(i % 7 == 6)
printf("\n");
}
printf("\n");
}
output:-

C++ code:-
#include <iostream>
#include <cstdlib>
#include <iomanip>
using namespace std;
bool isLeapYear (int); //check the year is leap or not
int firstDayofFirstMonth (int );
int noofDaysInMonth (int, bool); // takes the number of the month,
a flag saying whether the year is leap
void UpdateMonth (int); // takes the number of the month, and the
first day, prints, and updates
void printMonth (int, int&); // the first day of the next
month
void skip (int);// prints the specified amount of spaces
void skipToDay (int);// prints spaces in monthly calendar
void exitFunction (); // terminates program in case of Errors
int main ()
{
int year, firstDayInPresentMonth;
int currentMonth = 1;
int numDays;
bool leap;
cout << "What year do you want a calendar
for? ";
cin >>year;
cout<<endl;
firstDayInPresentMonth=firstDayofFirstMonth(year);
leap = isLeapYear(year);
skip(9);
cout << year << endl;
while (currentMonth <= 12)
{
numDays = noofDaysInMonth(currentMonth,
leap);
UpdateMonth(currentMonth);
printMonth(numDays,
firstDayInPresentMonth);
cout << endl << endl <<
endl;
currentMonth = currentMonth + 1;
}
cout << endl;
}
bool isLeapYear (int year)
{
return ((year%4==0) &&
(year%100 !=0))||(year%400==0)
;
}
int firstDayofFirstMonth(int year)
{
int day_start;
int x1, x2, x3;
x1 = (year - 1)/ 4;
x2 = (year - 1)/ 100;
x3 = (year - 1)/ 400;
day_start = (year + x1 - x2 + x3) %7;
return day_start;
}
int noofDaysInMonth (int m, bool leap)
{
if (m == 1) return(31);
else if (m == 2) if (leap) return(29);else
return(28);
else if (m == 3) return(31);
else if (m == 4) return(30);
else if (m == 5) return(31);
else if (m == 6) return(30);
else if (m == 7) return(31);
else if (m == 8) return(31);
else if (m == 9) return(30);
else if (m == 10) return(31);
else if (m == 11) return(30);
else if (m == 12) return(31);
else exitFunction();
return 0;
}
void UpdateMonth (int m)
{
if (m == 1)
{
skip(7);
cout << "January" << endl;
}
else if (m == 2) { skip(7); cout <<
"February" << endl; }
else if (m == 3) { skip(7); cout <<
"March" << endl; }
else if (m == 4) { skip(7); cout <<
"April" << endl; }
else if (m == 5) { skip(7); cout << "May"
<< endl; }
else if (m == 6) { skip(7); cout << "June"
<< endl; }
else if (m == 7) { skip(7); cout << "July"
<< endl; }
else if (m == 8) { skip(7); cout <<
"August" << endl; }
else if (m == 9) { skip(7); cout <<
"September" << endl; }
else if (m == 10) { skip(7); cout <<
"October" << endl; }
else if (m == 11) { skip(7); cout <<
"November" << endl; }
else if (m == 12) { skip(7); cout <<
"December" << endl; }
else exitFunction();
cout << " S M T W T F S"
<<endl;
cout << "____________________" <<
endl;
}
void skip (int i)
{
while (i > 0)
{
cout << " ";
i = i - 1;
}
}
void printMonth (int numDays, int &weekDay)
{
int day = 1;
skipToDay(weekDay);
while (day <= numDays)
{
cout << setw(2) << day << "
";
if (weekDay == 6)
{
cout <<
endl;
weekDay = 0;
}
else weekDay = weekDay + 1;
day = day + 1;
}
}
void skipToDay (int d)
{
return skip(3*d);
}
void exitFunction ()
{
cout << "exitFunction! Exiting ..."
<< endl;
exit ( -1);
}
output:-
print all months in a given input year

Creat a simple calendar programming that can print the month of any year Please C language...
Write a simple grep like simple utility in the C programming language. Approach the problem by following these steps: a) Your task is to write a simple grep like utility in the C programming language. You can name it “mygrep”. grep is basically used for searching. For example, “mygrep foo myfile” command returns all the lines that contain a string matching the expression "foo" in the file. Your code will be checked by running such a simple command. It is...
In C Programming Language, write a simple program to read one text file and print to screen all its text. Make use of the stderr and exit program statements should there not be only one text file identified on the command line. If successful then before fclose of the text file, use the fputs program statement to write a line "72 degrees Sunny light wind. Nice!\n". print the return code of fputs (should be zero). close and exit. Test program...
Use C Language to Create a calendar for year 2021 with month, date, day of week as output.
PLEASE USE C AS A PROGRAMMING LANGUAGE
PLEASE USE C AS A PROGRAMMING LANGUAGE
PLEASE USE C AS A PROGRAMMING LANGUAGE
PLEASE USE C AS A PROGRAMMING LANGUAGE
PLEASE USE C AS A PROGRAMMING LANGUAGE
PLEASE USE C AS A PROGRAMMING LANGUAGE
11. Initialize a integers in the two-dimensional array testArray to the values 1 through 9 using 1 or more while loops so that the array could be visualized as: 1 2 3 LA 5 6 7 8 9...
using R programming language, make a simple addition program that will allow input (any number) from the user.
Please write a C program to implement the calendar of the year (after the year 1900) you specify. For example, when you input 1900, the program print the calendar of year 1900 as the figure (partial) down below. Hint 1: Jan. 1st, 1900 is Monday. Hint 2: You will need to consider the case of Leap Year where there are 29 days in the month of February. In common years there are 28 days in the month of February. For...
Programming Language : Python Question a) Are there any programming framework for this language? If yes, where and how do you get them (URL) ? b) What is (are) the program development environments (s) available for this language? and what is provided in each program development environment?
Please Write in C programming Language
For Questions below. write computer code in any programming language or mathematical software to estimate dz using the given method. Then calculate the absolute and relative errors for each. Use exact value p 0.6044 戰,omposite Trapezoidal Rule with N = 6.
For Questions below. write computer code in any programming language or mathematical software to estimate dz using the given method. Then calculate the absolute and relative errors for each. Use exact value p...
Use Java please
Creating a calendar for a given year A shell for this assignment has been provided so that you can fill in the methods Homework 4 grading rubric 1. Output examples a. One Normal Year, 10% b. One Leap Year, 10% 2. Style Meaningful variable names, 10% b. Meaningful method names, 10 % c. Comments, Total: 10% . Do not comment every line. 5% . Comment non-obvious code. 5% a d. Indentation, 10% e. Block comment with name...
Print the two strings in alphabetical order in C programming language. Assume the strings are lowercase. End with newline. Sample output: capes rabbits