• Lenguaje

    Pascal

  • Descripción

    Generar números aleatorios entre 1 y 10.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
program AleatoriosEntre1Y10;
uses crt;

var numero_aleatorio : integer;
var tecla_repetir : char;
begin
    randomize;
    repeat
        clrscr;
        numero_aleatorio := 1+random(10);
        writeln ('Valor de numero aleatorio: ', numero_aleatorio);
        writeln;
        write (#168'Deseas repetir el proceso? (S/N): ');
        repeat
            tecla_repetir := readkey;
        until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
    until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
end.