-
Lenguaje
Pascal
-
Descripción
Cargar un número entero positivo de hasta tres cifras y muestre un mensaje indicando si tiene 1, 2 o 3 cifras. Mostrar un mensaje de error si el número de cifras es mayor.
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
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
program NumeroDeCifras;
uses crt;
var numero : integer;
begin
write ('Ingresa el valor de numero: ');
readln (numero);
if (numero>=0) and (numero<10) then
begin
writeln ('1 cifra');
end;
if (numero>=10) and (numero<100) then
begin
writeln ('2 cifras');
end;
if (numero>=100) and (numero<1000) then
begin
writeln ('3 cifras');
end;
if numero>=1000 then
begin
writeln ('Error');
end;
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var numero : integer;
begin
write ('Ingresa el valor de numero: ');
readln (numero);
if (numero>=0) and (numero<10) then
begin
writeln ('1 cifra');
end;
if (numero>=10) and (numero<100) then
begin
writeln ('2 cifras');
end;
if (numero>=100) and (numero<1000) then
begin
writeln ('3 cifras');
end;
if numero>=1000 then
begin
writeln ('Error');
end;
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.