Showing posts with label Data Statistics. Show all posts
Showing posts with label Data Statistics. Show all posts

Saturday, March 28, 2015

Data Statistics

Algorithm
Step 1 : Start
Step 2 : Initialize 0 to pc, sum, i
Step 3 : Read a number
Step 4 : If number = 9999 then goto step 10
Step 5 : Increment i by 1
Step 6 : If number􀀃􀂔 0 then goto step 3
Step 7 : Increment pc by 1
Step 8 : Add number to sum
Step 9 : Goto step 3
Step 10 : Compute avg = sum / pc
Step 11 : Print i, pc, avg,
Step 12 : Stop

Program (datastat.sh)
# Aggregate of positive nos using break and continue
clear
pc=0
s=0
i=0
until false
do
echo -n "Enter a number (9999 to quit) : "
read n
if [ $n -eq 9999 ]
then
break
fi