Advertisement
unnn

laur

May 10th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.66 KB | None | 0 0
  1. #!/bin/bash
  2. MAX_NO=0
  3. echo -n "Enter Number between (5 to 9) : "
  4. read MAX_NO
  5. if ! [ $MAX_NO -ge 5 -a $MAX_NO -le 9 ] ; then
  6.    echo "WTF... I ask to enter number between 5 and 9, Try Again"
  7.    exit 1
  8. fi
  9. clear
  10. for (( i=1; i<=MAX_NO; i++ ))
  11.     do    
  12.     for (( s=MAX_NO; s>=i; s-- ))
  13.             do
  14.                 echo -n " "
  15.             done
  16.         for (( j=1; j<=i;  j++ ))    
  17.         do      
  18.             echo -n " ."      
  19.         done    
  20.     echo ""
  21.     done
  22. ###### Second stage ######################
  23. for (( i=MAX_NO; i>=1; i-- ))
  24. do
  25.     for (( s=i; s<=MAX_NO; s++ ))
  26.     do
  27.        echo -n " "
  28.     done
  29.     for (( j=1; j<=i;  j++ ))
  30.     do
  31.      echo -n " ."
  32.     done
  33.     echo ""
  34. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement