Cod sursa(job #1199667)
| Utilizator | Data | 20 iunie 2014 10:15:16 | |
|---|---|---|---|
| Problema | Fractii | Scor | 10 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.42 kb |
var n,i,j,k,nr:longint;
function cmmdc(a,b:longint):longint;
begin
while a<>b do
if a>b then a:=a-b else b:=b-a;
end;
begin
assign(input,'fractii.in');
reset(input);
read(n);
close(input);
nr:=0;
for i:=1 to n do
begin
for j:=1 to n do
begin
if cmmdc(i,j)=1 then nr:=nr+1;
end;
end;
assign(output,'fractii.out');
rewrite(output);
write(nr);
close(output);
end.
