Show a Square
This is a warmup exercise.
It is not compulsory, and may be
completed individually or with your lab partner.
Your task is to write a program
called showSquare.c
that reads in a number as an int
,
and then prints out a square of that width and height,
using the character #
.
Some examples:
Enter a size: 4 #### #### #### ####
Enter a size: 9 ######### ######### ######### ######### ######### ######### ######### ######### #########
Enter a size: 16 ################ ################ ################ ################ ################ ################ ################ ################ ################ ################ ################ ################ ################ ################ ################ ################
To run some simple automated tests:
$ 1511 autotest showSquare
To run Styl-o-matic:
$ 1511 stylomatic showSquare.c Looks good!
You’ll get advice if you need to make changes to your code.
Submit your work with the give command, like so:
$ give cs1511 wk04_showSquare
Or, if you are working from home, upload the relevant file(s) to the wk04_showSquare activity on Give Online.