Cod sursa(job #43573)

Utilizator toni2007Pripoae Teodor Anton toni2007 Data 30 martie 2007 11:57:50
Problema Fractii Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.44 kb
var n,i,j,s:integer;f1,f2:text;
Function ired(x,y:integer):boolean;
var z:integer;
begin
ired:=true;
For z:=2 to x do begin
If (x mod z=0)and(y mod z=0)then ired:=false;
end;
end;
begin
assign(f1,'fractii.in');reset(f1);
assign(f2,'fractii.out');rewrite(f2);
read(f1,n);
s:=1;
For i:=1 to n do begin
For j:=1 to n do begin
If i<>j then begin
If ired(i,j)=true then s:=s+1;
end;
end;
end;
write(f2,s);
close(f1);
close(f2);
end.