Current location - Recipe Complete Network - Take-out food franchise - Enter a day of the week and the day of the month as the first day of the month, and print the monthly calendar of the month! thank you
Enter a day of the week and the day of the month as the first day of the month, and print the monthly calendar of the month! thank you
# include & ltstdio.h & gt

Master ()

{int i,j,n,m;

scanf("%d %d ",& ampn & amp; m); //n is the day of the week and m is the number of days.

printf(" 7 1 2 3 4 5 6 \ n "); //The first line outputs the marked week like a calendar.

for(I = 1; I & lt=(n% 7);); I++) // Fill in the space before the first row of data.

printf(" ");

for(I = 1; I<= m;; i++)

{//This loop is used to output every item of the calendar.

printf("%2d ",I);

If((i+n)%7==0)// decides whether to wrap a line.

printf(" \ n ");

}

}