Advertisement
apl-mhd

Pyramid

Jun 10th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. void showPyramid(int n){
  2.  
  3.         int i, j, k, m;
  4.         for( i=1; i<=n; i++){
  5.  
  6.  
  7.             for(int space=1; space<=n-i; space++ ){
  8.  
  9.                 System.out.print(" ");
  10.  
  11.             }
  12.  
  13.  
  14.             for( j=1; j<=i; j++){
  15.  
  16.                 System.out.print(j);
  17.             }
  18.  
  19.             //System.out.print("1");
  20.  
  21.             for( m=i-1; m>=1; m--){
  22.  
  23.                 System.out.print(m);
  24.             }
  25.  
  26.            System.out.println("");
  27.  
  28.  
  29.  
  30.  
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement