Pagini recente » Cod sursa (job #1885194) | Cod sursa (job #1545457) | Cod sursa (job #2831121) | Cod sursa (job #1894496) | Cod sursa (job #302388)
Cod sursa(job #302388)
var i,n,j,a,b,cn,r:longint;
f,g:text;
begin
assign(f,'fractii.in');
assign(g,'fractii.out');
reset(f);
rewrite(g);
readln(f,n);
cn:=n;
for i:=2 to n do
for j:=1 to n do
begin
if (i>=2) and (i<>j) then
begin
a:=i;
b:=j;
while a mod b<>0 do
begin
r:=a mod b;
a:=b;
b:=r;
end;
if b=1 then inc(cn);
end;
end;
write(g,cn);
close(f);
close(g);
end.