Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdio.h"
- int main (void)
- {
- int tag,monat,jahr;
- scanf("%d.%d.%d", &tag, &monat, &jahr);
- //a
- if (monat > 2)
- monat -= 3; //same as monat = monat - 3
- else
- {
- //b
- monat += 9;
- --jahr; //same as Jahr = Jahr - 1
- }
- //c
- int jh = jahr / 100;
- int jz = jahr % 100;
- //d
- int wtz = (146097*jh/4 + 1461*jz/4 + (153*monat+2)/5 +tag+1721119) % 7;
- //e
- char * Wochentage[] = {"Montag", "Dienstag", "Mittwoch", "Donnerstag","Freitag", "Sonnabend", "Sonntag"};
- printf("ist ein %s", Wochentage[wtz]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement