Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Write a shell script to find the average of the numbers entered in command line

Posted By: Volker Fischer     Category: Unix / Linux / Ubuntu     Views: 17343

Write a shell script to find the average of the numbers entered in command line

Code for Write a shell script to find the average of the numbers entered in command line in Unix / Linux / Ubuntu

sum=0
for i in $*
do
sum=`expr $sum + $i`
done
avg=`expr $sum / $n`
echo Average=$avg
  
Share: 



Volker Fischer
Volker Fischer author of Write a shell script to find the average of the numbers entered in command line is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Unix / Linux / Ubuntu:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Guru Bhagam from India Comment on: Mar 10
it is not working.here n is not defined in the 6th line.

View All Comments