Shell script to print left traingle, Programming Languages

Assignment Help:

Left Triangle

 

Program

 

#W.A.S.S. to create left triangle

 

echo -e "enter num:\c"

read n

j=1

k=1

 

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

do

  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 left traingle

Count no of files, Normal 0 false false false EN-US X...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Version control system, Version Control is a critical tool in development a...

Version Control is a critical tool in development and production environments that allows a user to make snapshots of working con?gurations or code. In this assignment, you will de

Unix, 1. Write a shell script to locate executable files. This script takes...

1. Write a shell script to locate executable files. This script takes a list of file names from the command line and determines which would be executed had these names been given a

Shell script to print count & sum of digits of given number, Normal 0 ...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Network security, Term project (you should code a function), demonstrate it...

Term project (you should code a function), demonstrate it to the class and a very breief report (one or two pages) describing what you did. You determine your project (could be imp

Matlab, Determine the moment of force about the point where a bracket is at...

Determine the moment of force about the point where a bracket is attached to a wall. the bracket is shown in figure attached. it extends 10 inched out from the wall and 5 inched up

Differences between user and kernel level threads, Question : (a) Many ...

Question : (a) Many systems provide support for both user threads and kernel threads, resulting in different multithreading models. What are the two differences between user

Code a simulation of image compression , Your task will be to code a simula...

Your task will be to code a simulation of image compression based on the approximate low rank structure of the set of image patches. You will write functions .code = my block compr

Cookies management with perl, One of the main strengths of the Perl program...

One of the main strengths of the Perl programming language are its powerful text manipulation features. In this assignment, you will put them to use for writing a Perl program that

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