Nickolay.info. .

. , .

PROGRAM WEEKDAY;

FUNCTION READINT (MSG:STRING;A,B:INTEGER):INTEGER;
 {    :
     A  B  }
VAR X:INTEGER;
BEGIN
 REPEAT
  WRITELN;
  WRITE (MSG,' [',A,',',B,'] ');
  {$I-}READ(X);{$I+}
  IF IORESULT<>0 THEN WRITELN (',   ')
  ELSE IF (X<A) OR (X>B) THEN WRITELN (',     [',A,',',B,']')
  ELSE BREAK;
  UNTIL FALSE;
 READINT:=X;
END;

VAR DAY,MONTH,YEAR,CENT,NUM,WEEK:INTEGER;

BEGIN
 DAY:=READINT (' ',1,31);
 MONTH:=READINT(' ',1,12);
 YEAR:=READINT(' ',1,32767);

 IF MONTH<3 THEN BEGIN
  INC(MONTH,12);
  DEC(YEAR);
 END;
 CENT:=YEAR DIV 100;
 NUM:=YEAR MOD 100;
 WEEK:=((MONTH+1)*26 DIV 10+DAY+ NUM + NUM div 4+ CENT div 4 - 2*CENT) mod 7;

 WRITE (DAY,'.',MONTH,'.',YEAR,'  ');
 CASE WEEK OF
  0: WRITELN('');
  1: WRITELN('');
  2: WRITELN('');
  3: WRITELN('');
  4: WRITELN('');
  5: WRITELN('');
  6: WRITELN('');
 END;
 WRITE (' ENTER  ');
 RESET (INPUT);
 READLN;
END.

C++ , :

#include <stdio.h>

void main () {
 int d=29,m=2,year=2012;
 if (m<3) { m+=12; year--; }
 int c=year/100,y=year%100,wd;
 wd=( (m+1)*26/10+d+y+y/4+c/4-2*c ) % 7;
 char *days[]={"Sat","Sun","Mon","Tue","Wed","Thu","Fri"};
 printf ("\n%s",days[wd]);
}

  " "

 

@Mail.ru

; E-mail