Напишите программу которая вводит натуральные числа a и n и вычисляет a^n без использования операции возведения в степень.
118
189
Ответы на вопрос:
Var a, n, i: integer; r: longint; begin r : = 1; readln(a, n); for i : = 1 to n do r : = r * a; write(r); end.
//pascalabc.net версия 3.2, сборка 1389 //если программа не запускается, то обновите версию uses graphabc; const kegl = 40; var space, line: integer; procedure m(cx, cy: integer); begin moveto(cx, cy); lineto(cx, cy - kegl ); lineto(cx + kegl div 2, cy); lineto(cx + kegl, cy - kegl); lineto(cx + kegl, cy); end; procedure i(cx, cy: integer); begin moveto(cx, cy - kegl); lineto(cx, cy ); lineto(cx + kegl, cy - kegl); lineto(cx + kegl, cy); end; procedure r(cx, cy: integer); begin moveto(cx, cy); lineto(cx, cy - kegl); lineto(cx + kegl, cy - kegl); lineto(cx + kegl, cy - kegl div 2); lineto(cx, cy - kegl div 2); end; begin space : = kegl div 2; setwindowsize(4 * space + 3 * kegl, 4 * space + 3 * kegl ); line : = space + kegl; m(space, line ); i(2 * space + kegl, line ); r(3 * space + 2 * kegl, line ); line : = 2 * space + 2 * kegl; r(space, line ); i(2 * space + kegl, line ); m(3 * space + 2 * kegl, line ); line : = 3 * space + 3 * kegl; m(space, line ); i(2 * space + kegl, line ); m(3 * space + 2 * kegl, line ); end.
Популярно: Информатика
-
Sehunjungkook28.01.2022 18:12
-
shaihiev12.03.2023 17:45
-
timoxaept18.10.2022 22:41
-
катерринкаа31.10.2021 05:34
-
Yana6hhhh06.08.2022 00:30
-
airfgh21.05.2021 21:06
-
ЛераКоролёва1319.09.2021 14:06
-
bilinia1620.08.2022 01:08
-
IiiPON4IKiiI29.09.2020 04:24
-
DruNastya07.06.2023 07:24