Java Loops II

  • + 5 comments

    yes, instead of this use Math.pow() operator..... Hope this is helpful!!!!

    for(int i=0;i

            int sum = a+b;
            for(int j=1; j<=n; j++){
                System.out.print(sum+" ");
                sum+=((Math.pow(2,j))*b);
            }
            System.out.println();
        }