Shell script to print right traingle, Programming Languages

Right triangle

 

Program

 

#W.A.S.S. to create right  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=`expr $n - $k`

 

  while test $j -gt 0         #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

                   *

                *  *

             *  *  *

          *  *  *  *

       *  *  *  *  *

    *  *  *  *  *  *

 *  *  *  *  *  *  *

Posted Date: 9/26/2012 4:35:28 AM | Location : United States







Related Discussions:- Shell script to print right traingle, Assignment Help, Ask Question on Shell script to print right traingle, Get Answer, Expert's Help, Shell script to print right traingle Discussions

Write discussion on Shell script to print right traingle
Your posts are moderated
Related Questions
You are asked to develop a replicator (client) that distributes a large job over a number of computers (a server group) on a single switched LAN (our BU04 lab). In this assignment,

Overview You will write a loadable kernel module. If you have an idea which you can convince me is a good idea that can not be done as a module, but only via direct modificatio

The Lost Bay Software Coop purchased EnviroMeasurements, a small startup with a product, GreenStation, that measures pollen count and air quality. The company has ventured

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

CSCI 3380 Project 1 For Mano’s Computer design, we have the following flowchart for fetch and decode phases: Please write the code to simulate the computer to

**This programming assignment is for use in the LINUX/UNIX environment!! Introduction: System administration often requires custom written programs and tools. One problem a syste

This assignment is an individual programming assignment using Perl. It addresses objectives 3, 4, 5 and 8 as listed in the Subject Outline document. The assignment is based on them

We now require starting looking into finding a particular solution for n th order differential equations. The two ways which we'll be looking at are similar as those which we look

Question 1 Discuss on Inheritance Question 2 What are the four phases of the object modeling technique that can be repetitively executed? Question 3 Explain the di

I have doubt in this section .do-while loop.could you able to clear it for me.