Cod sursa(job #45419)

Utilizator toni2007Pripoae Teodor Anton toni2007 Data 1 aprilie 2007 14:49:10
Problema Fractii Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.44 kb
var n,i,j,s:longint;f1,f2:text;
Function ired(x,y:integer):integer;
var z:integer;
label 1;
begin
ired:=0;
For z:=2 to x do begin
If (x mod z=0)and(y mod z=0)then begin
ired:=1;
goto 1;
end;
end;
1:end;
begin
assign(f1,'fractii.in');reset(f1);
assign(f2,'fractii.out');rewrite(f2);
read(f1,n);
s:=1;
For i:=1 to n-1 do begin
For j:=i+1 to n do begin
If ired(i,j)=0 then s:=s+2;
end;
end;
write(f2,s);
close(f1);
close(f2);
end.