Unix/Linux Go Back    

Homework & Coursework Questions Students must use and complete the template provided. If you don't, your post may be deleted! Special homework rules apply here.

Multiplication Table in UNIX

Homework & Coursework Questions

multiplication, scripting, shell, table, unix

Thread Tools Search this Thread Display Modes
Old Unix and Linux 07-13-2016
larkha larkha is offline
Registered User
Join Date: Jul 2016
Last Activity: 17 July 2016, 9:32 PM EDT
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
Multiplication Table in UNIX

How can I produce this kind of output?

Enter a number: 3

0 1 2 3
1 1 2 3
2 2 4 6
3 3 6 9

When you enter a number, it should show you the corresponding multiplication table. Plus we need to use for loops that I do not actually know. Thanks in advance! Here is my code

echo Enter a number:
read num
while [ $num –le 5 ]
res=`expr $num \* $iter`
echo $num “*” $iter “=” $res
iter=`expr $iter + 1`
Sponsored Links
Old Unix and Linux 07-13-2016
DukeNuke2's Unix or Linux Image
DukeNuke2 DukeNuke2 is offline Forum Staff  
Join Date: Jul 2006
Last Activity: 20 September 2017, 12:32 PM EDT
Location: Berlin, Germany
Posts: 5,698
Thanks: 73
Thanked 302 Times in 288 Posts
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Sponsored Links
Old Unix and Linux 07-13-2016
RudiC RudiC is online now Forum Staff  
Join Date: Jul 2012
Last Activity: 21 September 2017, 2:59 AM EDT
Location: Aachen, Germany
Posts: 11,353
Thanks: 297
Thanked 3,521 Times in 3,240 Posts
Fill in the entire questionnaire compulsory for homework (see rules).
The Following User Says Thank You to RudiC For This Useful Post:
larkha (07-14-2016)
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Create a table - very new to unix aj250 UNIX for Dummies Questions & Answers 11 07-19-2010 04:31 PM
Error with "multiplication table" in shell script vinodpaw Shell Programming and Scripting 4 03-22-2010 06:27 AM
nested loop:multiplication table killboy UNIX for Dummies Questions & Answers 1 10-15-2009 11:33 PM
Creating table in Unix mr_manii Shell Programming and Scripting 7 10-01-2009 09:17 AM
how to view symbol table in unix saravanan_nitt Programming 1 02-14-2008 12:02 AM

All times are GMT -4. The time now is 03:00 AM.