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
10 More Discussions You Might Find Interesting
1. Programming
hi ,
How to view the contents of a "c" program symbol table information in unix. (1 Reply)
Discussion started by: saravanan_nitt
1 Replies
2. Shell Programming and Scripting
Hi ,
Can anyone help me regarding loading a unix file data to oracle database table using shell scripts?
I wanted to grep only this data from a spool file
sql_test.txt
99
00:00:00:01
but if I use grep I am getting format
sql_test.txt
99 rows selected.
Elapsed:... (2 Replies)
Discussion started by: ran16
2 Replies
3. Shell Programming and Scripting
Hi All,
In a given directory, I need to list the files present in it in the below given format as a table.
File name Permission Number of Bytes File Type
Telecom1 --w-r-x 1230 Directory
Telecom2 ---x---x---x 450 Device file
Telecom3 ... (7 Replies)
Discussion started by: mr_manii
7 Replies
4. UNIX for Dummies Questions & Answers
I need help to produce output as below
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25
my script
#!/bin/bash
for (( i = 1; i <= 5; ++i ));
do
echo -n $i
for (( j = 1; j <=5; ++j ));
do
multiply=$(( $i * $j ))
done
echo $multiply (1 Reply)
Discussion started by: killboy
1 Replies
5. Shell Programming and Scripting
Hi,
I am trying to insert a record into a table (say dips_tbl) which resides in Oracle DB through a ksh script. I want to insert records into few of the table columns-not all. I'll give an e.g. for the date column "CREATE_DATE".
For that I first execute
SQL1="SELECT SYSDATE FROM DUAL"
... (1 Reply)
Discussion started by: dips_ag
1 Replies
6. Shell Programming and Scripting
#!/bin/sh
echo Enter the multiplication number required:
read number
for i in 1 2 3 4 5 6 7 8 9 10
do
echo "$number * $i = expr $number \* $i"
done
I am not getting the output for this multiplication table. (4 Replies)
Discussion started by: vinodpaw
4 Replies
7. UNIX for Dummies Questions & Answers
I need to create a simple table of information by grepping several columns from various files and display them all at once with simple headers on top. Can anyone help get me started? I am very new to unix so I really have no idea how to work with this and I appreciate any help I can get! Let me... (11 Replies)
Discussion started by: aj250
11 Replies
8. UNIX for Dummies Questions & Answers
Hi all,
I just downloaded this example from the net. I was looking around for a hash table like implementation in unix when I came across this.
ARRAY=( "cow:moo"
"dinosaur:roar"
"bird:chirp"
"bash:rock" )
for animal in ${ARRAY} ; do
KEY=${animal%%:*}
... (8 Replies)
Discussion started by: anindyabecs
8 Replies
9. Shell Programming and Scripting
Hello All,
i have a file sort.txt with below entries.
1 12 10
16 6 4
20 8 15
i need to sort these entries and the out put should come in a single line.
1 4 6 8 10 12 15 16 20
Can you please help me sort this out? (2 Replies)
Discussion started by: sureshk_85
2 Replies
10. Shell Programming and Scripting
Hi frndz,
Can anyone provide me some input or pseudo code for my req as mentioned below...
I am loading 2 files through unix script into oracle table...as i am doing some updates also i am getting an error where both files try to update the table simultaneously and my script fails..
so i... (3 Replies)
Discussion started by: gnnsprapa
3 Replies
LEARN ABOUT DEBIAN
gtk2::treestore
Gtk2::TreeStore(3pm) User Contributed Perl Documentation Gtk2::TreeStore(3pm)
NAME
Gtk2::TreeStore - wrapper for GtkTreeStore
HIERARCHY
Glib::Object
+----Gtk2::TreeStore
INTERFACES
Gtk2::TreeModel
Gtk2::TreeDragSource
Gtk2::TreeDragDest
Gtk2::TreeSortable
Gtk2::Buildable
METHODS
treestore = Gtk2::TreeStore->new (...)
o ... (list) of strings, package names
treeiter = $tree_store->append ($parent)
o $parent (Gtk2::TreeIter or undef)
$tree_store->clear
$tree_store->set_column_types (...)
o ... (list) of strings, package names
$tree_store->set ($iter, $col1, $val1, ...)
o $iter (Gtk2::TreeIter)
o $col1 (integer) the first column number
o $val1 (scalar) the first value
o ... (list) pairs of columns and values
treeiter = $tree_store->insert ($parent, $position)
o $parent (Gtk2::TreeIter or undef)
o $position (integer)
treeiter = $tree_store->insert_after ($parent, $sibling)
o $parent (Gtk2::TreeIter or undef)
o $sibling (Gtk2::TreeIter or undef)
treeiter = $tree_store->insert_before ($parent, $sibling)
o $parent (Gtk2::TreeIter or undef)
o $sibling (Gtk2::TreeIter or undef)
treeiter = $tree_store->insert_with_values ($parent, $position, ...)
o $parent (Gtk2::TreeIter or undef)
o $position (integer) position to insert the new row
o ... (list) pairs of column numbers and values
Like doing insert followed by set, except that insert_with_values emits only the row-inserted signal, rather than row-inserted, row-
changed, and, if the store is sorted, rows-reordered as in the multiple-operation case. Since emitting the rows-reordered signal
repeatedly can affect the performance of the program, insert_with_values should generally be preferred when inserting rows in a sorted tree
store.
Since: gtk+ 2.10
boolean = $tree_store->is_ancestor ($iter, $descendant)
o $iter (Gtk2::TreeIter)
o $descendant (Gtk2::TreeIter)
integer = $tree_store->iter_depth ($iter)
o $iter (Gtk2::TreeIter)
boolean = $tree_store->iter_is_valid ($iter)
o $iter (Gtk2::TreeIter)
Since: gtk+ 2.2
$tree_store->move_after ($iter, $position)
o $iter (Gtk2::TreeIter)
o $position (Gtk2::TreeIter or undef)
Since: gtk+ 2.2
$tree_store->move_before ($iter, $position)
o $iter (Gtk2::TreeIter)
o $position (Gtk2::TreeIter or undef)
Since: gtk+ 2.2
treeiter = $tree_store->prepend ($parent)
o $parent (Gtk2::TreeIter or undef)
boolean = $tree_store->remove ($iter)
o $iter (Gtk2::TreeIter)
The return is always a boolean in the style of Gtk 2.2.x and up, even when running on Gtk 2.0.x.
$tree_store->reorder ($parent, ...)
o $parent (Gtk2::TreeIter or undef)
o ... (list) of integer's, the new_order
Since: gtk+ 2.2
$tree_store->swap ($a, $b)
o $a (Gtk2::TreeIter)
o $b (Gtk2::TreeIter)
Since: gtk+ 2.2
$tree_store->set_value ($iter, $col1, $val1, ...)
o $iter (Gtk2::TreeIter)
o $col1 (integer) the first column number
o $val1 (scalar) the first value
o ... (list) pairs of columns and values
Alias for Gtk2::TreeStore::set().
SEE ALSO
Gtk2, Glib::Object
COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
perl v5.14.2 2012-05-27 Gtk2::TreeStore(3pm)