1
It is necessary to make a program in which the user type 5 numbers. If one of these numbers is repeated, he must ask the user to type another number again, but any number I type appears which is repeated. My code:
program numero_repetido;
var
numero: array [1..5] of integer;
i: integer;
ii: integer;
valoratual:integer;
begin
ii:= 1;
i:=1;
for i:= 1 to 5 do
begin
if i > 0 then
begin
Write('Digite um número inteiro: ');
read(numero[i]);
valoratual:= numero[i];
for ii:=1 to 5 do
begin
if valoratual = numero[ii] then
begin;
Write('Número já existe, digite outro: ');
i:=i-1;
end;
end;
end
else
begin
Write('Digite um número inteirooo: ');
read(numero[i]);
end;
end;
for i:= 1 to 5 do
begin
writeLN(numero[i]);
end;
END.