2.Write a Java program to generate the following Series.
1 2 4 8 16 32 ……….. (2^n)
Answers
Answered by
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