AfanasevGad7

This is a task for our favourite professor
git clone git://git.stellar-nexus.ru/AfanasevGad7
Log | Files | Refs | README

test.sh (233B)


      1 #!/bin/sh
      2 test -n "$1" || exit 1
      3 test -n "$2" && iter="$2" || iter=2
      4 
      5 sum=0
      6 i=0
      7 
      8 while $(test "$i" -lt "$iter"); do
      9 	val=$($1)
     10 	sum=$(echo "$sum + $val" | bc -l)
     11 	i=$((i + 1))
     12 done
     13 
     14 avg=$(echo "$sum / $iter" | bc -l)
     15 echo "$1: $avg"