Pagini recente » Cod sursa (job #1731100) | Cod sursa (job #1218286) | Cod sursa (job #315882) | Cod sursa (job #1267385) | Cod sursa (job #624071)
Cod sursa(job #624071)
program fractii;
var a,b,x,n,y,k:longint;
f,g:text;
function cm(x,y:integer):longint;
var c,i,j:longint;
begin
if x<y then
begin
for i:=1 to x do
if (y mod i = 0)and(x mod i = 0 ) then
c:=i;
end
else
if b<a then
for i:=1 to b do
if (x mod i = 0)and(y mod i = 0) then
c:=i;
cm:=c;
end;
begin{pp}
assign(f,'fractii.in');reset(f);
assign(g,'fractii.out');rewrite(g);
readln(f,n);
k:=0;
for a:=1 to n do
for b:=1 to n do
if (cm(a,b)=1) and (a<>b) then
begin
k:=k+1;
writeln(a,' ',b);
end;
write(g,k+1);
close(f);
close(g);
readln;
end.