-
Lenguaje
Pascal
-
Descripción
Determine el día de la semana y el nombre del mes 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
program DiaDeLaSemanaYMesDeCualquierFecha;
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;
if mes=1 then
begin
writeln ('Enero');
end;
if mes=2 then
begin
writeln ('Febrero');
end;
if mes=3 then
begin
writeln ('Marzo');
end;
if mes=4 then
begin
writeln ('Abril');
end;
if mes=5 then
begin
writeln ('Mayo');
end;
if mes=6 then
begin
writeln ('Junio');
end;
if mes=7 then
begin
writeln ('Julio');
end;
if mes=8 then
begin
writeln ('Agosto');
end;
if mes=9 then
begin
writeln ('Septiembre');
end;
if mes=10 then
begin
writeln ('Octubre');
end;
if mes=11 then
begin
writeln ('Noviembre');
end;
if mes=12 then
begin
writeln ('Diciembre');
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;
if mes=1 then
begin
writeln ('Enero');
end;
if mes=2 then
begin
writeln ('Febrero');
end;
if mes=3 then
begin
writeln ('Marzo');
end;
if mes=4 then
begin
writeln ('Abril');
end;
if mes=5 then
begin
writeln ('Mayo');
end;
if mes=6 then
begin
writeln ('Junio');
end;
if mes=7 then
begin
writeln ('Julio');
end;
if mes=8 then
begin
writeln ('Agosto');
end;
if mes=9 then
begin
writeln ('Septiembre');
end;
if mes=10 then
begin
writeln ('Octubre');
end;
if mes=11 then
begin
writeln ('Noviembre');
end;
if mes=12 then
begin
writeln ('Diciembre');
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.