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
JavaScript is "Object Oriented" like C++ or Java. (Note that Java and JavaScript are not the same language, which is a common misconception) It also has variables, which makes Java

Introduction This assignment builds on your application, produced in Assignment 1, which holds a list of cabins, which can be either read in from a text file or just hard coded

I have an assignment that requires from me to run multiple clients and one server ( Corba)

NOTE: You will only submit the University.java and EmptyFileException.java files (inside P3.zip/tar) NOTE on null objects:. From Project 1: Since the array of students in the Cou

The idea of this section is not to do anything new along with a series solution problem.  Instead this is here to exemplify that moving in a higher order differential equation does

You must use the keyword ''var'' to create and initialize a variable. The placement of the variable creation in your code is very important. Examples: var first = 21; var secon

Create a DTD which describes the structure of the document which you prepared in Question 1. Make sure that you use all appropriate DTD ingredients to constrain valid documents as

i attached the assignment document only i need your help with following three parts: accessible areas, accessible cul-de-sacs that are all connected, entry-exit path with no in

You are to build a Schema in XML Schema Language that will be used to support the development of the new central course information management system and other supporting applicati

how to get horizontal motion vectors field with quiver ?