Pagini recente » Cod sursa (job #1782145) | Cod sursa (job #742892) | Cod sursa (job #3040595) | Cod sursa (job #476450) | Cod sursa (job #624078)
Cod sursa(job #624078)
program fractii;
var a,b,x,n,y,k:integer;
f,g:text;
function cm(x,y:integer):integer;
begin
if x<>y then
repeat
if x>y then x:=x-y
else y:=y-x;
until x=y;
cm:=x;
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.