• Lenguaje

    Pascal

  • Descripción

    Cree un algoritmo que capture un mes en números y el software muestre un mensaje que indique cuantos días tiene ese mes. Ejemplo: si se digita "07", el algoritmo debe mostrar "Julio, tiene treinta un día". El algoritmo debe también advertir que si se trata de febrero tiene 28 días, pero si el año fuera bisiesto tendría 29.

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
program NombreDelMesYNumeroDeDias;
uses crt;

var anno, mes : integer;
begin
    write ('Ingresa el valor de anno: ');
    readln (anno);
    write ('Ingresa el valor de mes: ');
    readln (mes);
    if mes=1 then
        begin
            writeln ('Enero, tiene treinta un d'#161'as.');
        end;
    if (mes=2) and (((anno mod 4=0) and (anno mod 100<>0)) or (anno mod 400=0)) then
        begin
            writeln ('Febrero, tiene veintinueve d'#161'as.');
        end;
    if (mes=2) and ((anno mod 4<>0) or (anno mod 100=0)) and (anno mod 400<>0) then
        begin
            writeln ('Febrero, tiene veintiocho d'#161'as.');
        end;
    if mes=3 then
        begin
            writeln ('Marzo, tiene treinta un d'#161'as.');
        end;
    if mes=4 then
        begin
            writeln ('Abril, tiene treinta d'#161'as.');
        end;
    if mes=5 then
        begin
            writeln ('Mayo, tiene treinta un d'#161'as.');
        end;
    if mes=6 then
        begin
            writeln ('Junio, tiene treinta d'#161'as.');
        end;
    if mes=7 then
        begin
            writeln ('Julio, tiene treinta un d'#161'as.');
        end;
    if mes=8 then
        begin
            writeln ('Agosto, tiene treinta un d'#161'as.');
        end;
    if mes=9 then
        begin
            writeln ('Septiembre, tiene treinta d'#161'as.');
        end;
    if mes=10 then
        begin
            writeln ('Octubre, tiene treinta un d'#161'as.');
        end;
    if mes=11 then
        begin
            writeln ('Noviembre, tiene treinta d'#161'as.');
        end;
    if mes=12 then
        begin
            writeln ('Diciembre, tiene treinta un d'#161'as.');
        end;
    writeln;
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.