write a program in java to print the series 1 2 4 8 16--------------1024
Answers
Answered by
1
import java.util.Scanner;
public class Print_Series {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n,i;
System.out.printf("Enter the range of number(Limit):");
n=sc.nextInt();
for(i=1;i<=n;i*=2)
{
System.out.print(i+" ");
}
sc.close();
}
}
Similar questions