Computer Science, asked by Anonymous, 7 days ago

2.Write a Java program to generate the following Series.
1 2 4 8 16 32 ……….. (2^n)

Answers

Answered by CopyThat
2

Program:  {JAVA}

public class Series2 {

   public void main(int n) {

      for(int i=0;i<=n;i++) {

              System.out.print ( (int) Math.pow(2,i) + “  " );

}

}

   }

Similar questions