Answered step by step
Verified Expert Solution
Question
1 Approved Answer
User Lab 3 - Fancy shapes In this lab we'll be focusing on the C programming aspect. This will cover for - loops and if
User
Lab Fancy shapes
In this lab we'll be focusing on the C programming aspect. This will cover forloops
and ifstatements. To practice these we'll be drawing some shapes in the terminal!
The input will be one of the following numbers, passed through argv:
A square
A triangle
An inverted triangle upside down
A diamond
Your program will take in arguments. The first is a number between and
indicating which of the shapes listed above you'll be printing. The second argument is
a number indicating the largest horizontal width of the shape. For example, for a
triangle, this'll be the width of the base.
Your program will print the indicated shape at the indicated dimensions. Write your
code in the main.c file provided in the starter repository.
Examples
Example
aout
Output:
$$$$
$$$$
$$$$
$$$$
Example
aout
Output:
$$$$$$$$$$
$$$$$$$$$$
$$$$$$$$$$
$$$$$$$$$$
$$$$$$$$$$
$$$$$$$$$$
$$$$$$$$$$
$$$$$$$$$$
$$$$$$$$$$
$$$$$$$$$$
Example
aout
Output:
$$
$$$$
$$$$$$
Notice how with an even number for the width, will result with at the top, not one.
Example
aout
Output:
$
$$$
$$$$$
$$$$$$$
$$$$$$$$$
Example
aout
Output:
$$$$$$$$$$$$$$
$$$$$$$$$$$$
$$$$$$$$$$
$$$$$$$$
$$$$$$
$$$$
$$
Example
aout
Output:
$$
$$$$
$$$$$$
$$$$$$$$
$$$$$$$$$$
$$$$$$$$$$$$
$$$$$$$$$$$$$$
$$$$$$$$$$$$
$$$$$$$$$$
$$$$$$$$
$$$$$$
$$$$
$$
Example
aout
Output:
$
$$$
$$$$$
$$$$$$$
$$$$$$$$$
$$$$$$$$$$$
$$$$$$$$$$$$$
$$$$$$$$$$$$$$$
$$$$$$$$$$$$$
$$$$$$$$$$$
$$$$$$$$$
$$$$$$$
$$$$$
$$$
$
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