-
Lenguaje
Pascal
-
Descripción
Determine el día de la semana de cualquier fecha desde enero de 1700.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
program DiaDeLaSemanaDeCualquierFecha;
uses crt;
var anno, bisiesto, dia, mes, modulo : integer;
var numero : integer;
begin
write ('Ingresa el valor de anno: ');
readln (anno);
write ('Ingresa el valor de dia: ');
readln (dia);
write ('Ingresa el valor de mes: ');
readln (mes);
if ((anno mod 4=0) and (anno mod 100<>0)) or (anno mod 400=0) then
begin
bisiesto := 1;
end
else
begin
bisiesto := 0;
end;
modulo := 0;
if ((bisiesto=0) and (mes=5)) or ((bisiesto=1) and (mes=10)) then
begin
modulo := 1;
end;
if ((bisiesto=0) and (mes=8)) or ((bisiesto=1) and (mes=5)) then
begin
modulo := 2;
end;
if ((bisiesto=0) and ((mes=2) or (mes=3) or (mes=11))) or ((bisiesto=1) and ((mes=2) or (mes=8))) then
begin
modulo := 3;
end;
if ((bisiesto=0) and (mes=6)) or ((bisiesto=1) and ((mes=3) or (mes=11))) then
begin
modulo := 4;
end;
if ((bisiesto=0) and ((mes=9) or (mes=12))) or ((bisiesto=1) and (mes=6)) then
begin
modulo := 5;
end;
if ((bisiesto=0) and ((mes=4) or (mes=7))) or ((bisiesto=1) and ((mes=9) or (mes=12))) then
begin
modulo := 6;
end;
numero := ((anno-1) mod 7+((anno-1) div 4-3*((anno-1) div 100+1) div 4) mod 7+modulo+dia mod 7) mod 7;
if numero=0 then
begin
writeln ('Domingo');
end;
if numero=1 then
begin
writeln ('Lunes');
end;
if numero=2 then
begin
writeln ('Martes');
end;
if numero=3 then
begin
writeln ('Mi'#130'rcoles');
end;
if numero=4 then
begin
writeln ('Jueves');
end;
if numero=5 then
begin
writeln ('Viernes');
end;
if numero=6 then
begin
writeln ('S'#160'bado');
end;
writeln ('Valor de bisiesto: ', bisiesto);
writeln ('Valor de modulo: ', modulo);
writeln ('Valor de numero: ', numero);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var anno, bisiesto, dia, mes, modulo : integer;
var numero : integer;
begin
write ('Ingresa el valor de anno: ');
readln (anno);
write ('Ingresa el valor de dia: ');
readln (dia);
write ('Ingresa el valor de mes: ');
readln (mes);
if ((anno mod 4=0) and (anno mod 100<>0)) or (anno mod 400=0) then
begin
bisiesto := 1;
end
else
begin
bisiesto := 0;
end;
modulo := 0;
if ((bisiesto=0) and (mes=5)) or ((bisiesto=1) and (mes=10)) then
begin
modulo := 1;
end;
if ((bisiesto=0) and (mes=8)) or ((bisiesto=1) and (mes=5)) then
begin
modulo := 2;
end;
if ((bisiesto=0) and ((mes=2) or (mes=3) or (mes=11))) or ((bisiesto=1) and ((mes=2) or (mes=8))) then
begin
modulo := 3;
end;
if ((bisiesto=0) and (mes=6)) or ((bisiesto=1) and ((mes=3) or (mes=11))) then
begin
modulo := 4;
end;
if ((bisiesto=0) and ((mes=9) or (mes=12))) or ((bisiesto=1) and (mes=6)) then
begin
modulo := 5;
end;
if ((bisiesto=0) and ((mes=4) or (mes=7))) or ((bisiesto=1) and ((mes=9) or (mes=12))) then
begin
modulo := 6;
end;
numero := ((anno-1) mod 7+((anno-1) div 4-3*((anno-1) div 100+1) div 4) mod 7+modulo+dia mod 7) mod 7;
if numero=0 then
begin
writeln ('Domingo');
end;
if numero=1 then
begin
writeln ('Lunes');
end;
if numero=2 then
begin
writeln ('Martes');
end;
if numero=3 then
begin
writeln ('Mi'#130'rcoles');
end;
if numero=4 then
begin
writeln ('Jueves');
end;
if numero=5 then
begin
writeln ('Viernes');
end;
if numero=6 then
begin
writeln ('S'#160'bado');
end;
writeln ('Valor de bisiesto: ', bisiesto);
writeln ('Valor de modulo: ', modulo);
writeln ('Valor de numero: ', numero);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.