fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int length = 10;
  13.  
  14. int i = length;
  15.  
  16. System.out.println("While Loop");
  17.  
  18. while(i-- >0){
  19. System.out.println(i);
  20. }
  21.  
  22. System.out.println("For loop");
  23.  
  24. for(i = length;i>=1 ;i-=1){
  25. System.out.println(i);
  26. }
  27. }
  28. }
Success #stdin #stdout 0.08s 380160KB
stdin
Standard input is empty
stdout
While Loop
9
8
7
6
5
4
3
2
1
0
For loop
10
9
8
7
6
5
4
3
2
1