fork download
  1. import java.util.Scanner;
  2. class Jtutorial1 {
  3. public static void main(String args[]){
  4. Scanner input = new Scanner(System.in);
  5. int i=0;//initialize a new variable for use as a counter
  6. while(i < 10){//While the variable is less than 10
  7. System.out.println(i);//Print the current value for i
  8. i+=2;//increase the value of i by 2
  9. }//end while
  10. i=1;//set i equal to 1
  11.  
  12.  
  13. do{//does the loop condition at LEAST once
  14. System.out.println(i);// output i
  15. i*=2; // multiply the current value of i by 2
  16. }while(i<4096);//until i is 4096 or greater
  17.  
  18.  
  19.  
  20.  
  21. }//end main
  22. }//end class
Success #stdin #stdout 0.06s 213888KB
stdin
Standard input is empty
stdout
0
2
4
6
8
1
2
4
8
16
32
64
128
256
512
1024
2048