Computer Science, asked by samboy1047, 11 months ago

write the programs in java to display the first 10 numbers of the series 4,8,16,32............n

Answers

Answered by mdanas27
19

Answer:

Public class Demo

{

public static void main(String args[])

{

for(int i = 1; i < 8; i++)

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

}

}

Hope this helps!

Answered by samridhi1501
6

By using scanner:-

import java.util.*;

public class Series

{

public static void main(String args[])

{

Scanner sc = new Scanner (System.in);

System.out.print ("Enter a number:");

int n=sc.nextInt();

int j=0;

for( int i=2; i<=n; i++)

{

j= Math.pow(2,i);

System.out.println( j + " , " );

}

}

}

Similar questions