• 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
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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: 62806
203
  • 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: 20310
110
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: 62806
203
  • 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: 62806
203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

Hahahahahahahaha!
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!