Pagini recente » Cod sursa (job #1729480) | Cod sursa (job #1212083) | Cod sursa (job #1395307) | Cod sursa (job #1817892) | Cod sursa (job #339456)
Cod sursa(job #339456)
function ggt(a,b:integer):integer;
begin
while a<>b do
if a>b then a:=a-b
else b:=b-a;
ggt:=a;
end;
var n,i,j,ct:longint;
f1,f2:text;
begin
assign(f1,'fractii.in');
reset(f1);
assign(f2,'fractii.out');
rewrite(f2);
read(f1,n);
for i:=1 to n do
for j:=1 to n do
if ggt(i,j)=1 then inc(ct);
write(f2,ct);
close(f1);
close(f2);
end.