What language are you after?
In Python you can use the double asterisk to express an exponent, like this
eight = 2 ** 3
Other languages have mathematics libraries with typically a pow() or power() function.
In C, you'd write
#include <stdio.h>
#include <math.h>
int main()
{
float eight = pow(2, 3);
printf("%f\n", eight);
return 0;
}