Pagini recente » Cod sursa (job #1175273) | Cod sursa (job #1344440) | Cod sursa (job #554646) | Cod sursa (job #168137) | Cod sursa (job #113041)
Cod sursa(job #113041)
function prim(x,y:longint):boolean;
var i,aux:longint;
f1:boolean;
begin
if y>x then begin
aux:=x;
x:=y;
y:=aux;
end;
f1:=true;
for i:=2 to y do
if (y mod i=0) and (x mod i=0) then f1:=false;
prim:=f1
end;{verificare numere prime}
var f,g:text;
a,n,i,j:longint;
begin
assign(f,'fractii.in');
reset(f);
assign(g,'fractii.out');
rewrite(g);
read(f,n);
close(f);
a:=0;
for i:=1 to n do
for j:=1 to i div 2 do
if prim(i,j)=true then a:=a+1;
write(g,a);
close(g);
end.