# Shell Programming
# Sum of N numbers
echo -n "Enter N : "
read n
i=0
sum=0
while [ $i -lt $n ]
do
echo -n "Enter number : "
read val
sum=`expr $sum + $val`
i=`expr $i + 1`
done
echo "Sum of entered numbers = $sum"
# Sum of N numbers
echo -n "Enter N : "
read n
i=0
sum=0
while [ $i -lt $n ]
do
echo -n "Enter number : "
read val
sum=`expr $sum + $val`
i=`expr $i + 1`
done
echo "Sum of entered numbers = $sum"
No comments:
Post a Comment
Don't be a silent reader...
Leave your comments...
Anu