Есть ответ 👍

Напишите программу которая вводит натуральные числа a и n и вычисляет a^n без использования операции возведения в степень.

118
189
Посмотреть ответы 2

Ответы на вопрос:


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.

Популярно: Информатика