This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
nishi kishore wrote:suppose i entered a number 2 then the output must be as follows :
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.