Shell script to print pyramid, Programming Languages

Assignment Help:

Shell Script to print pyramid

 

Program

 

#W.A.S.S. to create pyramid

 

echo -e "enter num:\c"

read n

j=1

k=1

 

while test $k -le $n          #this loop print as many * per line as the value of j

do

 

  j=$k

 

  while test $j -lt $n         #this loop print forward spaces in each line

  do

     echo -e " \c"            

     j=`expr $j + 1`

  done

 

  j=1

  while test $j -le $k        #this loop print as many * per line as the value of j

  do

     echo -e " * \c"

     j=`expr $j + 1`

  done

 

  echo " "

  k=`expr $k + 1`

 

done

 

Output

 

enter num:7

       *
      *  *
     *  *  *
    *  *  *  *
   *  *  *  *  *
  *  *  *  *  *  *
 *  *  *  *  *  *  *

      

 

 


Related Discussions:- Shell script to print pyramid

Create application for a book store, You need to create a simple applicatio...

You need to create a simple application for the Note Plus book Store. The interface for the application is shown below:   REQUIRED: 1)  Create all necessary contro

C, what is the c.

what is the c.

Learning when and how to use a while loop, 1.  A function that produces the...

1.  A function that produces the Collatz sequence and counts the number of terms. 2.  A main function that calculates interesting values about the Collatz sequence. 1.The Col

Fortran function for find and print out all prime number, Write a Fortran L...

Write a Fortran LOGICAL FUNCTION, called "is_prime", which determines if a given integer value is a prime number or not (A prime number is a natural number which has only two disti

Irc or internet relay chat application, Programming Project Specification: ...

Programming Project Specification: IRC or Internet Relay Chat is an application that lets multiple users communicate via text messages with each other in common "virtual" rooms.

Produce a hierarchy chart-a structured flowchart, Produce a hierarchy chart...

Produce a hierarchy chart, a structured flowchart, and a Pascal program (with appropriate comments) to generate the Sales Commission Report shown below. The commission for each sal

Write a program to compute the standard deviation, Write three functions, s...

Write three functions, statistics, average, and sD as follows. The statistics function returns no value and has six parameters: four scores followed by their average and standard d

develop a web page via href attribute, 1.  Develop a Web page via href att...

1.  Develop a Web page via href attribute of anchor tag and the attribute: vlink, alink, etc. 2.  Develop a Web page, in which when the user clicks on the link it will go to the

Need support in mobile app using angularjs and cordova, Need support in Mob...

Need support in Mobile app using AngularJS, Cordova (PhoneGap), Ionicframework We need an experienced front-end developer with a obsession for performance in mobile environment.

Script of switch case, Write a script called 'prob3.m' that does the same t...

Write a script called 'prob3.m' that does the same thing as the previous question except that it makes use of a switch-case construct instead of an if-else. In the file 'hw4.m'

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd