You are on page 1of 1

echo "enter n number"

read n
read pcount
pcount=0
read ncount
ncount=0
read psum
psum=0
read nsum
nsum=0
read zcount
zcount=0
for (( i=0; i<=n; i++ ))
do
echo "enter a number"
read a
if test $a -gt 0
then
echo "$a is positive number"
pcount=`expr $pcount + 1`
echo "count of positive is $pcount"
psum=`expr $psum + $a`
echo "sum of positive is $psum"
elif test $a lt 0
then
echo "$a is negative number"
ncount=`expr $ncount + 1`
echo "count of negative is $ncount"
nsum=`expr $nsum + $a`
echo "sum of negative is $nsum"
elif test $a eq 0
echo "$a is zero"
zcount=`expr $zcount + 1'
echo "count of zero is $zcount"
fi
done

You might also like