Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Shell Script to create a pyramid of number

Posted By: Vilhelm Fischer     Category: Unix / Linux / Ubuntu     Views: 44598

Write a Shell Script to create a pyramid of number.

1
22
333

Code for Shell Script to create a pyramid of number in Unix / Linux / Ubuntu

echo "enter the number"
read n
for((i=1;i<=n;i++))
dofor ((j=1;j<=i;j++))
 do
 echo -e "$i \c"
 done
 echo " "
done




OUTPUT
***********
$ sh pattern.sh
enter the number
3
1
2 2
3 3 3
  
Share: 


Didn't find what you were looking for? Find more on Shell Script to create a pyramid of number Or get search suggestion and latest updates.

Vilhelm Fischer
Vilhelm Fischer author of Shell Script to create a pyramid of number is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Sneha Dasari from United States Comment on: Mar 13
for((i=1;i<=5;i++))
do
for((j=1;j<=i;j++))
do
echo -e "$j \c"
done
echo " "
done

Kaushik Domadiya from India Comment on: Sep 10
how to print this pyrimind
1
12
122
1223
12233
122333

View All Comments