Win a copy of Functional Reactive Programming this week in the Other Languages forum!

# generate a table for a given number

nishi kishore
Ranch Hand
Posts: 32
hello,
i want to generate a table for an integer number.
although it is a very simple program but i have to use pointer for this program.

fred rosenberger
lowercase baba
Bartender
Posts: 12196
35
Can you elaborate? I'm not sure what you mean by 'generate a table for a given number' - and I doubt anybody else knows either.

nishi kishore
Ranch Hand
Posts: 32
suppose i entered a number 2 then the output must be as follows :
2
4
6
8
10
12
14
16
18
20

but i want to generate the table using pointer for a given number.

Palak Mathur
Ranch Hand
Posts: 342
It means Multiplication tables. Ok.

fred rosenberger
lowercase baba
Bartender
Posts: 12196
35
• 1
nishi kishore wrote:suppose i entered a number 2 then the output must be as follows :
2
4
6
8
10
12
14
16
18
20

but i want to generate the table using pointer for a given number.

One of the toughest things to learn is that an example is not a definition of what you want to do. Yes, it can help illustrate, but you need to think about what REALLY needs to be done.

The first step is always to forget about C, Java, Perl, assembly or any other computer programming language. The first step is to LITERALLY write down the steps involved. You can write by hand, type it into notepad, or have your secretary type it in triplicate using carbon paper...but you must somehow get them written down. This step is critical in getting your brain to really think about the problem. So, for this, I would start with something like

1) get the number
2) print the table based on a number

Now, I break each of these down further. Also, note that these steps are COMPLETELY independent of each other. I can get the number by prompting the user, by passing it in from the command line, by reading it from a file, or a million other ways. What matters is that I get it somehow. Further, assuming I have a number, I need to print a table. No matter where the number came from, once I have it, printing the table is always going to be handled the same way.

So, the next step would be to pick one of the two items above, and break it down further. Give that a try, and post what you get here.

azim sain
Greenhorn
Posts: 14
To generate a table do

removed

Stephan van Hulst
Bartender
Posts: 6323
78
• 1
Azim, please DontBeACodeMill. You're robbing Nishi of a learning experience.