• Lenguaje

    Pascal

  • Descripción

    Se ingresan N números enteros, se quiere saber cuantos múltiplos a 5 de han ingresado y cuantos múltiplos a 2 se han ingresado.

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

var i, multiplos_de_2, multiplos_de_5, n, un_numero : integer;
begin
    multiplos_de_2 := 0;
    multiplos_de_5 := 0;
    write ('Ingresa el valor de n: ');
    readln (n);
    for i:=1 to n do
    begin
        writeln ('PROCESO ', i);
        write ('Ingresa el valor de un numero: ');
        readln (un_numero);
        if un_numero mod 2=0 then
            begin
                multiplos_de_2 := multiplos_de_2+1;
            end;
        if un_numero mod 5=0 then
            begin
                multiplos_de_5 := multiplos_de_5+1;
            end;
        writeln;
    end;
    writeln ('Valor de multiplos de 2: ', multiplos_de_2);
    writeln ('Valor de multiplos de 5: ', multiplos_de_5);
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.