Advertisement
Guest User

Recursion

a guest
Apr 29th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1.  
  2. /**
  3. * A program that converts numbers to binary using recursion!
  4. *
  5. * @author Nitin Armstrong (the one and only)
  6. * @version 4.20
  7. */
  8. import java.io.*;
  9. import java.util.Scanner;
  10. public class BinaryPrintsvsRecursion
  11. {
  12. public static void main(String [] args) {
  13. Scanner scan = new Scanner(System.in);
  14. System.out.println("Hello, I am Elytra and welcome to recurion, a top class conversion tool.");
  15. System.out.println("Input the integer you wish to convert");
  16. int input = scan.nextInt();
  17. division(input);
  18. }
  19. public static int division(int input){
  20. int digit = input / 2;
  21. int counter = 0;
  22. counter++;
  23. if (digit > 0) {
  24. digit / 2;
  25. counter++
  26.  
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement