#!/bin/sh
if [[ $# -ne 2 ]]
then
exit
fi
echo " m $1 by n $2 matrix"
n=$2
m=$1
mult=0
add=0
c=0
for ((i=1;i < m;i++))
do
echo "row = i = $i"
for ((j=i;j < m;j++))
do
((mult=mult + (n-i+1)))
((add=add + (n-i+1)))
done
((c=c+(m-i)*(n-i+1)))
done
echo "additions = $add"
echo "mults = $mult"
echo "summation = $c"
No comments:
Post a Comment