Pagini recente » Cod sursa (job #2360744) | Cod sursa (job #2174749) | Cod sursa (job #443005) | Cod sursa (job #29743) | Cod sursa (job #2605)
Cod sursa(job #2605)
program p1;
uses crt, dos;
var fin, fout:text;
s:array[1..10000] of real;
n, i, j, k, nk:longint;
ok:boolean;
begin
clrscr;
assign(fin,'fractii.in');
reset(fin);
assign(fout,'fractii.out');
rewrite(fout);
readln(fin, n);
if (n<=1) and (n<=1000000) then
nk:=0;
for i:= 1 to n do
for j:= 1 to n do
begin
ok:=false;
for k:= 1 to nk do
if s[k]=(i/j) then
ok:=true;
if ok=false then
begin
nk:=nk+1;
s[nk]:=i/j;
end;
end;
writeln(fout, nk);
writeln('Sunt ',nk,' fractii ireductibile');
readln;
close(fin);
close(fout);
end.