Java Loops II

  • + 3 comments
    int tempAnswer = A;
    for (int j = 0; j < loop; j++) {
            if (j == 0)
                tempAnswer += a;
        tempAnswer += (int) (Math.pow(2.0, j) * B);
        System.out.print(tempAnswer + " ");
    }
    
    
    
        This will work as we need to add a in the first instance only