Google Search

Thursday, October 6, 2011

Write a shell script to generate a multiplication table


Write a shell script to generate a multiplication table


echo Multiplication Table: 
echo Which table do you want ? (Give Number):
read num
iter=1
while [ $num –le 5 ]
do
res=`expr $num \* $iter`
echo $num “*” $iter “=” $res
iter=`expr $iter + 1`
done

1 comments:

Piyush Prakash said...

#!/bjn/bash
echo "enter the value of j:"
read n
i=1
for((i=1;i<=10;i++))
do
echo " $n * $i = ` expr $n \* $i` "
done

Post a Comment