小编den*_*den的帖子

我想将数字之和除以一个值

这是我的 Unix shell 脚本代码

#! /bin/ksh

echo "Enter your first number:"    
read first

echo "Enter your second number:"    
read second

echo "Enter your third number:"    
read third

SUM=`expr $first + $second + $third`    
AVERAGE="$SUM/3"

echo "The average is $AVERAGE"
Run Code Online (Sandbox Code Playgroud)

基本上我想找到用户输入的 3 个值的平均值。输入所有值后得到的结果,例如所有值加起来为 12;是“平均值是12/3”。

shell scripting ksh

2
推荐指数
1
解决办法
5712
查看次数

标签 统计

ksh ×1

scripting ×1

shell ×1