这是我到目前为止所拥有的:
echo "Please enter your first number: "
read a
echo "Second number: "
read b
(等等。)这很好用,但是当我尝试为求和平均值和乘积设置函数时,我遇到了一些问题。
这是我尝试过的:
sum= ($a + $b + $c + $d + $e)
avg= ($sum / 5) #The five was showing up in red text
prod= ($a * $b * $c * $d * $e)
echo "The sum of these numbers is: " $sum
echo "The average of these numbers is: " $avg
echo "The product of these numbers is: " $prod
但是当我运行它时(在我输入数字 1、2、3、4、5 之后)我得到了这个:
The sum of these numbers is: 1 + 2 + 3 + 4 + 5
The average of these numbers is: 1 + 2 + 3 + 4 + 5 / 5
The product of these numbers is: 1 * 2 * 3 * 4 * 5
所以我的问题是如何让这些函数在 ()
任何帮助表示赞赏,谢谢。