Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <locale.h>
- int month(int s, int n)
- {
- int i;
- if (s == 0)
- s = 7;
- printf("_____________________\n");
- printf(" Пн Вт Ср Чт Пт Сб Вс\n");
- printf("_____________________\n");
- for (i = 1; i < s; i++)
- printf(" ");
- for (i = 1; i <= n; i++)
- {
- printf("%3d",i);
- if ((s + i) % 7 == 1)
- printf("\n");
- }
- printf("\n\n");
- s = (s + n) % 7;
- if (s == 0)
- s = 7;
- return s;
- }
- int main()
- {
- int g, Feb, b, m, y;
- setlocale(LC_ALL, "Rus");
- printf("Введите год: ");
- scanf("%d", &g);
- if (g % 4 ==0)
- Feb = 29;
- else
- Feb = 28;
- if (g % 100 ==0)
- Feb = 28;
- if (g % 400 ==0)
- Feb = 29;
- y=g-1;
- m=11;
- b=(1 + y + y / 4 - y / 100 + y / 400 + (31 * m) / 12) % 7 ;
- printf("Январь \n");
- b = month(b, 31);
- printf("Февраль \n");
- b = month(b, Feb);
- printf("Март \n");
- b = month(b, 31);
- printf("Апрель \n");
- b = month(b, 30);
- printf("Май \n");
- b = month(b, 31);
- printf("Июнь \n");
- b = month(b, 30);
- printf("Июль \n");
- b = month(b, 31);
- printf("Август \n");
- b = month(b, 31);
- printf("Сентябрь \n");
- b = month(b, 30);
- printf("Октябрь \n");
- b = month(b, 31);
- printf("Ноябрь \n");
- b = month(b, 30);
- printf("Декабрь \n");
- b = month(b, 31);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement