-
Lenguaje
Pascal
-
Descripción
Realize un algoritmo donde, dado un grupo de números positivos, calcule e imprima el cubo de estos números.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
program CuboDeUnGrupoDeNumeros;
uses crt;
var cubo, un_numero : real;
var tecla_repetir : char;
begin
repeat
clrscr;
write ('Ingresa el valor de un numero: ');
readln (un_numero);
cubo := un_numero*un_numero*un_numero;
writeln ('Valor de cubo: ', cubo:0:6);
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.
uses crt;
var cubo, un_numero : real;
var tecla_repetir : char;
begin
repeat
clrscr;
write ('Ingresa el valor de un numero: ');
readln (un_numero);
cubo := un_numero*un_numero*un_numero;
writeln ('Valor de cubo: ', cubo:0:6);
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.