小编use*_*056的帖子

如何在不使用math.pow for java的情况下获得指数

这是我的计划

// ************************************************************
    // PowersOf2.java
    //
    // Print out as many powers of 2 as the user requests
    //
    // ************************************************************

    import java.util.Scanner;

    public class PowersOf2 {

    public static void main(String[] args)

    {
        int numPowersOf2; //How many powers of 2 to compute
        int nextPowerOf2 = 1; //Current power of 2
        int exponent= 1;
        double x;

         //Exponent for current power of 2 -- this
        //also serves as a counter for the loop Scanner

        Scanner scan = new Scanner(System.in);
        System.out.println("How many powers …
Run Code Online (Sandbox Code Playgroud)

java math exponent pow

5
推荐指数
2
解决办法
6万
查看次数

标签 统计

exponent ×1

java ×1

math ×1

pow ×1