Write a shell script to enter a string and then print its manipulation table?



echo "Enter a number for which the multiplication table is to be written "
read number1
echo "The length up to which table is to be written "
read number2
echo "Multiplication table for" $number1 " is given below "
count=1
while [ $count -le $number2 ]
do
result=`expr $number1 \* $count`
echo $count "*" $number1 "=" $result
count=`expr $count + 1`
done







 OUTPUT :

Enter a number for which the multiplication table is to be written
2
The length upto which table is to be written
10
Multiplication table for 2  is given below
1 * 2 = 2
2 * 2 = 4
3 * 2 = 6
4 * 2 = 8
5 * 2 = 10
6 * 2 = 12
7 * 2 = 14
8 * 2 = 16
9 * 2 = 18
10 * 2 = 20

Comments

Popular posts from this blog

Write a program to add two number using inline function in C++?

Traversing of elements program with algorithm and Flowchart