Pages

Print The Number Following Patttern

Shell script print the number following pattern


1
2 2
3 3 3
4 4 4 4
5 5 5 5 5


#!/bin/bash
clear
i=1
while [ $i -le 5 ]
do
n=1
    while [ $n -le $i ]
    do
    echo " $i \c "
    n=`expr $n + 1 `
    done
echo "\n"
 i=`expr $i + 1 `
done