The TransCompilator

Solved LeetCode program · 50 of 1,000

#0050 · Pow(x, n)

Medium Math chunk-01.md

Original English source

The result is 1.0. The factor is 2.0. The power is 10.
Repeat while power is more than 0.
If power modulo 2 is 1, set result to result times factor. Set factor to factor times factor. Set power to power divided by 2.

Report result.

Open in Playground Browse all 1,000 problems

Expected stdout

1024.0000