Advertisement
Shailrshah

Pyramid Pattern

Nov 4th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.30 KB | None | 0 0
  1. #! /bin/bash
  2.  
  3. echo -n "Enter the number of rows: "
  4. read n
  5.  
  6. count=1
  7. for(( i=0; i<$n; i++ )){
  8.     for(( space=$n-$i-1; space>=0; space-- )){
  9.             echo -n " "
  10.     }
  11.     for(( j=0; j<=i; j++ )){                              
  12.             echo -n "$count "
  13.             let count+=1
  14.     }
  15.     echo ""
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement