Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main(int argc, char *argv[])
- {
- int i,j;
- int Days[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
- int firstday = 3 ;
- char *weekdays[] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
- for(i=0;i<7;i++)
- printf("%4s",*(weekdays+ i));
- printf("\n");
- for(j=0;j<firstday;j++)
- printf(" ");
- int k,flag =0;
- for(i=0;i<12;i++)
- {
- for(j=1;j<=Days[i];j++)
- {
- printf(" %3d",j);
- if(j%7==(7-(firstday+flag)%7)) //de
- printf("\n");
- }
- printf("\n");
- flag = flag + Days[i];
- for(k=0;k<((firstday+flag)%7);k++) //de
- printf(" ");
- //printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment