Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact
Version 1 (modified by jpelcis, 18 years ago)
--

Python Challenge -- Level 0 -- Alternate Solution

Code

import tango.io.Stdout;
import tango.math.core;

void main () {
        Stdout.print(cast(long)exp2(38));
}

Explanation

        Stdout.print(cast(long)exp2(38));

tango.math.exp2 is used to raise 2 to an arbitrary power. This example does 238. The number is then cast to long so that it will be displayed in integer format instead of as a floating point. The result is printed to the screen.