задача 2 урок 21

задача 2 урок 21

Дано целое положительное число N. Выведите на экран все число от 1 до N (по возрастанию).

Решение
Функция
f

unction chislo(n: integer): integer;
begin
  if n <> 0 then
  begin
    result := chislo(n - 1);
    write(n);
  end;
end;

var n: integer;
begin
  readln(n);
  chislo(n);
  readln
end.

Процедура

program task_2_lesson21;
procedure chislo(n, a: integer);
begin
  if a = n then
    write(n)
  else
  begin
    write(a,' ');
    chislo(n,a + 1);
  end;
end;

var n: integer;
begin
  readln(n);
  chislo(n, 1);
  readln
end.

Консоль

12
1 2 3 4 5 6 7 8 9 10 11 12
vedro-compota's picture

procedure chislo(n, a: integer);

решить с 1 аргументом

_____________
матфак вгу и остальная классика =)