Write a program that reads in the size of a square and thenprints a hollow squar
ID: 3616501 • Letter: W
Question
Write a program that reads in the size of a square and thenprints a hollow square ofthat size out of asterisks and blanks. Your program should work forsquares of all sizes
between 1 and 20. If the input is greater than 20 or less than 1use 20 or 1, respectively.
For example, if the user enters 5, it shoud print
Sample Output:
Enter length of side:5
*****
* *
* *
* *
*****
Enter length of side:10
**********
* *
* *
* *
* *
* *
* *
* *
* *
**********
Enter length of side:25
Invalid Input
Using default value 20
********************
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
********************
Write a program that reads in the size of a square and thenprints a hollow square of
that size out of asterisks and blanks. Your program should work forsquares of all sizes
between 1 and 20. If the input is greater than 20 or less than 1use 20 or 1, respectively.
For example, if the user enters 5, it shoud print
Sample Output:
Enter length of side:5
*****
* *
* *
* *
*****
Enter length of side:10
**********
* *
* *
* *
* *
* *
* *
* *
* *
**********
Enter length of side:25
Invalid Input
Using default value 20
********************
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
********************
Explanation / Answer
please rate - thanks #include using namespace std; int main() {int i,j,side; coutside; if(sideRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.