Showing posts with label Multiplication Table. Show all posts
Showing posts with label Multiplication Table. Show all posts

Sunday, February 22, 2015

Multiplication Table

Algorithm
Step 1 : Start
Step 2 : Read the value of n
Step 3 : Initialize 1 to i
Step 4 : Print n, i, n×i
Step 5 : Increment i by 1
Step 6 : Repeat steps 4 and 5 until i 􀁤 10
Step 7 : Stop

Program (multable.sh)
# Multiplication table using for loop
clear
echo -n "Which multiplication table? : "
read n
for x in 1 2 3 4 5 6 7 8 9 10
do
p=`expr $x \* $n`
echo -n "$n X $x = $p"
sleep 1
done