задача 2 урок 21
Primary tabs
Дано целое положительное число 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
- Log in to post comments
- 649 reads
vedro-compota
Wed, 11/10/2021 - 18:55
Permalink
procedure chislo(n, a:
решить с 1 аргументом
_____________
матфак вгу и остальная классика =)