• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to print table of an integer using recursion  RSS feed

 
Bhavesh Kumar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've asked this question in a interview... that write the code to print table of 5 using recursion... can you please guide me some logic....
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37398
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JavaScript?

With recursion you have a base case and a recursive case. What do you think they should be there?
 
Bhavesh Kumar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just write a recursive method in java to print table of a number....
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66263
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this a Java or a JavaScript question? Please show some effort in posting your question.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37398
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. I'll move this to a Java forum rather than a JavaScript one then.

With recursion you have a base case and a recursive case. What do you think they should be there?

My question still applies. What do you think for these two things? It's ok to be wrong, but you are going to have to contribute some information to get help. Bear and I know how to do this. Feeding you the answer without you showing some thinking isn't going to teach you anything.
 
arulk pillai
Author
Ranch Hand
Posts: 3413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is an example of Iteration Vs. Recursion. Can you now try and solve the above problem?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!