Pagini recente » Cod sursa (job #2947382) | Cod sursa (job #1209218) | Cod sursa (job #2084894) | Cod sursa (job #1152618) | Cod sursa (job #278293)
Cod sursa(job #278293)
program fractii;
type cus=1..1000000;
var
f,g:text;
p,q,n:cus;
i:longint;
function diva (a,b:cus):boolean;
var ok:boolean;
begin
while a<>b do
if a>b then a:=a-b
else b:=b-a;
if a=1 then ok:=true
else ok:=false;
diva:=ok;
end;
begin
i:=0;
assign (f, 'fractii.in'); reset (f);
assign (g,'fractii.out'); rewrite (g);
readln (f,n);
for p:=1 to n do
for q:=1 to n do
if diva (p,q) then i:=i+1;
write (g,i);
close (g);
end.