Write a Java method that meets the following specification: public static void digits(int c) // Precondition: c

Question:

Write a Java method that meets the following specification:

public static void digits(int c)
// Precondition: c is one of the ints 0 to 9.
// Postcondition: The method has printed a
// pattern of digits as follows:
// 1. If the parameter c is 0, then output is '0'.
// 2. For other values of c, the output consists of
// three parts:
// -- the output for the previous number (c-1);
// -- followed by the digit c itself;
// -- followed by a second copy of the output for
// the previous number.
// There is no newline printed at the end of the
// output. Example output: digits(3) will print
// this to System.out: 010201030102010

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

Step by Step Answer:

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