const N = 12;
var i, l, c, k, sum:integer;
A:array[1..N] of integer;
begin
for i:=1 to N do begin
A[i]:=random(101);
write(A[i], ' ');
end;
writeln();
for l:=1 to N do begin
if i<>l then begin
sum:=A[i]+A[l];
for c:=1 to 300 do begin
if sum mod c = 0 then
k:=k+1;
if k=2 then
writeln(A[i], '+', A[l], '=', sum);
k:=0;
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
const N = 12;
var i, l, c, k, sum:integer;
A:array[1..N] of integer;
begin
for i:=1 to N do begin
A[i]:=random(101);
write(A[i], ' ');
end;
writeln();
for i:=1 to N do begin
for l:=1 to N do begin
if i<>l then begin
sum:=A[i]+A[l];
for c:=1 to 300 do begin
if sum mod c = 0 then
k:=k+1;
end;
if k=2 then
writeln(A[i], '+', A[l], '=', sum);
k:=0;
end;
end;
end;
end.