Solução em Pascal do Problema 9

program Multiplos;

var i, j, multi, multj, n: integer;

begin
 readln(N, i, j);
 multi := 0;
 multj := 0;
 
 while n <> 0 do
  begin
   if multi < multj
    then begin
     write(multi);
     multi := multi + i
    end
   else if multj < multi
         then begin
          write(multj);
          multj := multj + j
         end
        else begin
         write(multi);
         multi := multi + i;
         multj := multj + j
        end
   n := n - 1
  end
end.   


Lista de Problemas

História da Computação | Listas de Exercícios | Problemas Resolvidos | macmulti@ime.usp.br