Pagini recente » Cod sursa (job #1247251) | Cod sursa (job #1902260) | Cod sursa (job #3137604) | Cod sursa (job #264882) | Cod sursa (job #147197)
Cod sursa(job #147197)
var v:array[1..50] of boolean;
x,y,p,q,i,j,n,cmmdc,k:longint;
f,g:text;
begin
k:=0;
assign(f,'fractii.in');reset(f);
assign(g,'fractii.out');rewrite(g);
read(f,n);
for p:=1 to n do
for q:=1 to n do
begin
x:=p;
y:=q;
while x<>y do
if x>y then x:=x-y
else y:=y-x;
cmmdc:=x;
if cmmdc=1 then inc(k);
end;
write(g,k);
close(f);
close(g);
end.