Write a Java method with the following header: public static void binaryPrint(int n) The number n is

Question:

Write a Java method with the following header:

public static void binaryPrint(int n)

The number n is non-negative. The method prints the value of n as a binary number. If n is zero, then a single zero is printed; otherwise, no leading zeros are printed in the output. The '\n' character is NOT printed at the end of the output. Your implementation must be recursive and not use any local variables.

EXAMPLES:

n=0 Output: 0
n=4 Output: 100
n=27 Output: 11011

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: