👤
Home Man
Search
Today's Posts
Register

Students must use and complete the template provided. If you do not use the template your post may be deleted! Special homework rules apply here.

Multiplication Table in UNIX

Tags
multiplication, scripting, shell, table, unix

👤 Login to reply

 
Thread Tools Search this Thread
# 1  
Old 07-13-2016
Multiplication Table in UNIX

How can I produce this kind of output?

Enter a number: 3
MULTIPLICATION TABLE:

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

#!/bin/bash
echo Enter a number:
read num
iter=1
while [ $num –le 5 ]
do
res=`expr $num \* $iter`
echo $num “*” $iter “=” $res
iter=`expr $iter + 1`
done
# 2  
Old 07-13-2016
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.
# 3  
Old 07-13-2016
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)
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to lock Oracle table through UNIX? gnnsprapa Shell Programming and Scripting 3 10-15-2013 03:34 AM
How to sort matrix table in UNIX? sureshk_85 Shell Programming and Scripting 2 03-01-2013 10:01 AM
Unix path stored as a column in table 2jnags Shell Programming and Scripting 2 05-21-2012 09:25 PM
Hash Table like implementation in unix anindyabecs UNIX for Dummies Questions & Answers 8 05-25-2011 03:44 PM
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
unix file to oracle table ran16 Shell Programming and Scripting 2 06-14-2008 02:27 PM
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 05:13 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password