Logo 
Search:

Unix / Linux / Ubuntu Articles

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

Write a shell script to find the sum, the average and the product of the four integers entered

Posted By: Bette Fischer     Category: Unix / Linux / Ubuntu     Views: 11067

Write a shell script to find the sum, the average and
the product of the four integers entered

Code for Write a shell script to find the sum, the average and the product of the four integers entered in Unix / Linux / Ubuntu

echo Enter four integers with space between
read a b c d
sum=`expr $a + $b + $c + $d`
avg=`expr $sum / 4`
dec=`expr $sum % 4`
dec=`expr \( $dec \* 1000 \) / 4`
product=`expr $a \* $b \* $c \* $d`
echo Sum=$sum
echo Average=$avg.$dec
echo Product=$product
  
Share: 



Bette Fischer
Bette Fischer author of Write a shell script to find the sum, the average and the product of the four integers entered is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

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

 
No Comment Found, Be the First to post comment!