Java Loops II

  • + 16 comments

    int A = 5; int B = 3; int loop = 5;

        int tempAnswer = A;
        for (int j = 0; j < loop; j++) {
            tempAnswer += (int) (Math.pow(2.0, j) * B);
            System.out.print(tempAnswer + " ");
        }