#!/bin/bash
s=0
read-p"pleaseinput:"num
s=$(($s+$num))
max=$num
min=$num
avg=$(($s/5))
foriin`seq4`
do
read-p"pleaseinput:"num
s=$(($s+$num))
if[$num-le$min]then
min=$num
fi
if[$num-ge$max]then
max=$num
fi
done
echomax:$maxmin:$minavg:$avg
扩展资料:
for循环:
一般格式为:
forvarinitem1item2...itemN
do
command1
command2
...
commandN
done
写成一行:
forvarinitem1item2...itemNdocommand1command2?done
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)