logo CodeStepByStep logo

ascii_figure

Language/Type: C for nested loops
Related Links:

Write a function named ascii_figure that accepts an integer parameter called size and draws a figure of the following form, using for loops. The call of ascii_figure(5); would produce the following output:

////////////////\\\\\\\\\\\\\\\\
////////////********\\\\\\\\\\\\
////////****************\\\\\\\\
////************************\\\\
********************************

The size parameter can be used to create a similar figure of any size. The call of ascii_figure(3); would produce the following output:

////////\\\\\\\\
////********\\\\
****************

The call of ascii_figure(7); would produce the following output:

////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\
////////////////////********\\\\\\\\\\\\\\\\\\\\
////////////////****************\\\\\\\\\\\\\\\\
////////////************************\\\\\\\\\\\\
////////********************************\\\\\\\\
////****************************************\\\\
************************************************
Function: Write a C function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.