Cod sursa(job #97906)
| Utilizator | Data | 9 noiembrie 2007 10:48:24 | |
|---|---|---|---|
| Problema | Fractii | Scor | 10 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
function cmmdc(x, y: longint): longint;
var r: longint;
begin
while y<>0 do begin
r:=x mod y;
x:=y;
y:=r;
end;
cmmdc:=x;
end;
var f: text;
i, j, x, n: longint;
begin
assign(f, 'fractii.in');
reset(f);
readln(f, n);
close(f);
x:=0;
for i:=1 to n do
for j:=1 to n do
if cmmdc(i, j)=1 then
inc(x);
assign(f, 'fractii.out');
rewrite(f);
writeln(f, x);
close(f);
end.