Question: Write a recursive function named printLine ( ) which receives a character and an int parameters. If the int parameter is positive, the function prints
Write a recursive function named printLine which receives a character and
an int parameters. If the int parameter is positive, the function prints the character
repeatedly to form a line of the given number of character; otherwise the function does
nothing. The function does not return a value. Thus, if the printLine is called,
asterisks will be printed. The function MUST NOT use a loop of any kind
or an array to accomplish its job. Instead, it gets the job done by recursively calling
itself. You can test printLine first using the following example:
Example run:
Then write a recursive function printBlock that uses printLine to print m lines of n
characters each. For example, printBlock produces the character, in
lines, each has of the character.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
