fork download
  1. class Numpyramid
  2. {
  3. public static void main(String[] args)
  4. {
  5.  
  6.  
  7. int rows = 5;
  8.  
  9. for (int i = 1; i <= rows; i++)
  10. {
  11. for (int j = 1; j <= i; j++)
  12. {
  13. System.out.print(j+" ");
  14. }
  15.  
  16. System.out.println();
  17. }
  18.  
  19. }
  20. }
Success #stdin #stdout 0.09s 27628KB
stdin
Standard input is empty
stdout
1 
1 2 
1 2 3 
1 2 3 4 
1 2 3 4 5