diff --git a/systeme/tp/revision/max.sh b/systeme/tp/revision/max.sh new file mode 100755 index 0000000..2453b01 --- /dev/null +++ b/systeme/tp/revision/max.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +pg=0 + +for i; do + if [ $pg -lt $i ]; then + pg=$i + fi +done +if [ $pg -eq 0 ];then + echo "Pb, le plus grand est null" >&2 + exit 1 +fi +echo "$pg" diff --git a/systeme/tp/revision/moyenne.sh b/systeme/tp/revision/moyenne.sh new file mode 100755 index 0000000..6367a8c --- /dev/null +++ b/systeme/tp/revision/moyenne.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +som=0 +nb=0 + + +for i; do + som=$(($som + $i)) + nb=$(($nb + 1)) +done +moy=$(($som/$nb)) +echo "$moy"