Computer Science, asked by saitejasai7501, 10 months ago

How to write program for 2,4,8,16....64using java for loop?

Answers

Answered by EliteDaMyth
1

public class Program

{

   public static void main(String[] args) {

       for(int i = 1; i <= 100; i *= 2){

           System.out.print(i);

           System.out.print(",");

       }

   }

}

Thanks :)

Similar questions