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

Scenario A campsite provides cabins for travellers to stay in overnight. A 'cabin' is a small wooden hut, containing bunk beds, table and chairs, a heater, and a small cookin

I need to write code to compute matrix multiplication without using built in function.

CrowdSporting Website Development I want an advanced web developer to spend 1-2 days coding our newly designed website. It will be a single page scrolling site, fully designed a

Expertsmind brings you unique solution in java assignments Swing Move is the primary Java GUI gadget tool set. It is part of Oracle's Java Groundwork Sessions (JFC) - an A

I have constantly been emailing to get the task i had paid for to be done correctly but no replies from anyone. Not even one acknowledging my emails. Been phoning all the way from

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

i want to record in database but how to delete only duplicate field not row in vb 6.0 or ms-access

Write a program that accepts a date from the user in the form mm/dd/yyyy and then displays it in the form month dd, yyyy, where month is the name of the month. Enter a date (mm/d

need someone to write a simple cobol program for me..urgent