Cod sursa(job #1972159)
Utilizator | Data | 22 aprilie 2017 11:56:58 | |
---|---|---|---|
Problema | Fractii | Scor | 0 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
Program Fractii;
var s,d,a,b,n: longint;
g,f:text;
procedure euclid(a,b:longint;var d:longint);
begin
if b<>0 then begin
euclid(b,a mod b,d);
end else
d:= a;
end;
begin
assign(f,'fractii.in');reset(f);
assign(g,'fractii.out');rewrite(g);
readln(f,n);
for a:=1 to n do
for b:=1 to n do begin
euclid(a,b,d);
if d = 1 then
s:=s+1;
end;
writeln(g,s);
end.