• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Recursive Method to Convert Decimal Number into a Binary Number  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please help me to Write a recursive method to convert a decimal number into a binary number, Printing the Binary number?
And Also please tell me about Recursive methods
 
Marshal
Posts: 61690
192
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

A recursive method is one which calls itself. If you use recursion, you make each call slightly smaller than its predecessor, and you must eventually reach a call so small that the recursion stops. That latter is called the base case.
Please show us the algorithm/formula you have been given to convert a decimal number to binary.
 
Bartender
Posts: 19955
94
Android Eclipse IDE Linux
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The entry in Stan Kelley-Bootle's "The Devil's DP Dictionary for "recursion" reads as follows:

dictionary entry wrote:
recursion

See recursion

 
Nadun Fernando
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I'm learning java and i don't know how to write a recursive method, so i have no code written. Could you please give me a code using recursive methods to convert Decimal to Binary
 
Campbell Ritchie
Marshal
Posts: 61690
192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Nadun Fernando wrote:. . . Could you please give me a code using recursive methods to convert Decimal to Binary

No. We don't work like that. We expect you to try something first.
 
Campbell Ritchie
Marshal
Posts: 61690
192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:. . . The Devil's DP Dictionary for "recursion" . . .

Hahahahahahahaha!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!