Cod sursa(job #2337968)

Utilizator obleacmihaiObleac Mihai obleacmihai Data 6 februarie 2019 20:54:00
Problema Fractii Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.53 kb
function al (a,b : longint) : longint;
var z : longint;
begin
  while a <>0 do
   begin
     if a <b then
      begin
        z := a;
        a := b;
        b := z;
      end;
      a := a mod b;
   end;
   al := b;
end;
var i,n,j,c,z : longint;
f,g : text;
begin
assign(f, 'fractii.in' );
assign(g, 'fractii.out');
reset(f);
rewrite(g);
read(f,n);
 for i := 1 to n do
  begin
    for j := 1 to n do
    begin

       if  al(i,j) = 1 then
        z := z+1;
    end;
  end;
  write(g,z);
  close(g);
end.