Click
New Example
to start working through an example. Click on the instructions in the steps of the algorithm to see the values of the variables in each step. First click on step 1. and then on the following steps in the order of execution.
New Example
Restart Example
Algorithm.
Naive exponentiation.
Input:
An integer
b
and a natural number
n
Output:
b
n
if
n
= 0
then return
1
let
i
:= 0
let
c
:= 1
repeat
let
i
:=
i
+ 1
let
c
:=
c ⋅ b
until
i=n
return
c