Advertisement
a3f

Uebung8

a3f
Dec 4th, 2013
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include "stdio.h"
  2.  
  3.  
  4. int main (void)
  5. {
  6.     int tag,monat,jahr;
  7.     scanf("%d.%d.%d", &tag, &monat, &jahr);
  8.     //a
  9.     if (monat > 2)
  10.         monat -= 3; //same as monat = monat - 3
  11.     else
  12.     {
  13.     //b
  14.         monat += 9;
  15.         --jahr; //same as Jahr = Jahr - 1
  16.     }
  17.  
  18.     //c
  19.     int jh = jahr / 100;
  20.     int jz = jahr % 100;
  21.     //d
  22.     int wtz = (146097*jh/4 + 1461*jz/4 + (153*monat+2)/5 +tag+1721119) % 7;
  23.     //e
  24.     char * Wochentage[] = {"Montag", "Dienstag", "Mittwoch", "Donnerstag","Freitag", "Sonnabend", "Sonntag"};
  25.     printf("ist ein %s", Wochentage[wtz]);
  26.  
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement