Find max and min no.from numbers passed through command line, Programming Languages

Assignment Help:

10.     W.A.S.S to find maximum and minimum number from numbers passed through command line.

 

Program

 

# W.A.S.S to find maximum and minimum number from numbers passed through command #line.

 cnt=$#

# //$# gives the count of total number of command line arguments

 

if [ $cnt -gt 0 ]

then

min=$1

max=$1

 for i in $* # $* stores the command line arguments

 do

  if [ $i -gt $max ]

  then

   max=$i

  elif [ $i -lt $min ]

  then

   min=$i

  fi  

 done

 

echo "Minimum is : $min"

echo "Maximum is : $max"

else

 echo "Enter the command arguments properly:"

fi

 

Output

 

sh cmdline.sh 23 12 45

Minimum is : 12

Maximum is : 45


Related Discussions:- Find max and min no.from numbers passed through command line

Pseudo code, I need help putting this into a flowchart constant c as Intege...

I need help putting this into a flowchart constant c as Integer = 3500 Constant CALORIESTOOUNCE as Integer = 219 Declare Sex as Character Declare Age as Integer Declare Weight as I

Depth estimation from a single view camera, i doing a project about depth e...

i doing a project about depth estimation, i have done some research, and i used the block matching algorithm to get the motion vectors from the image sequences, i now have the prob

Formulas, how do I change a existing formula with a new formula and it show...

how do I change a existing formula with a new formula and it show the result

Programming project, Create a visualization (programming project) and demon...

Create a visualization (programming project) and demonstrate it in the class. The project should be related to distributed systems. (A distributed system consists of multiple auton

Mathematical expression of linear programming problem, A Consultant Dietici...

A Consultant Dietician provides diet and nutritional advice to clients. A client's diet requires that all the food s/he eats come from one of the four "basic food groups" (chocolat

Programming (problem solving), develop a pseudocode algorithm to determine ...

develop a pseudocode algorithm to determine the total amount of extra cost changed to the organizers for expenses accurednduring the workshop. the code is to be written for an unde

Program to output a triangle wave, 1.) Write a flowchart and program to do ...

1.) Write a flowchart and program to do the following: A pressure sensor in a cooling system measures the pressure of the refrigerant and is connected to Port -1 of the 8051. If th

ActionScript, looking for help with a flash game assignment.

looking for help with a flash game assignment.

What do you meant by a function, (a) (i) What do you meant  by a function? ...

(a) (i) What do you meant  by a function? Are functions required when writing a C program? (ii) State one of the advantages to the use of functions. (iii) What do you meant by a

Recursive decent parser, Given grammar Grammar M following: 1 - - > b...

Given grammar Grammar M following: 1 - - > begin end 2 - - > 3 - - > 4 - - > ? 5 - - > Id : = ; 6 - - > read ( ) ; 7 - - > write ( )

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