👤

se citesc n numere naturale in variabila x.Sa se afiseze produsulnumerelor care au catul egal cu restul la impartirea la k

Răspuns :

Program Augustin;
var
x:array [1..10] of integer;
n,i,k,s:integer;
y,z:real;
begin
Writeln('Introdu cite "n" numere naturale introduci');
readln(n);
for i:=1 to n do
begin
Writeln('x[',i,']=');
readln(x[i]);
end;
Writeln('Introdu "k"');
readln(k);
for i:=1 to n do
begin
y:=x[i] mod k;
z:=x[i] div k;
if y=z then s:=s+x[i];
end;
Writeln('Suma ',round(s));
readln;
end.