Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started