Question: Write a program called xtreme.c that reads an (odd) integer n from standard input, and prints an n x n a square of asterisks and
Write a program called xtreme.c that reads an (odd) integer n from standard input, and prints an nxn a square of asterisks and dashes in the following pattern:
For more examples of this pattern, see the example program output at the end of this question
You can assume n is odd and >= 5.
Make your program match the examples below exactly.
This exercise is designed to give you practice with while loops, if statements and some mathematical operators.
not permitted to use an array in this exercise.
./xtreme Enter size: 5 *---* -*-*- --*-- -*-*- *---* ./xtreme Enter size: 7 *-----* -*---*- --*-*-- ---*--- --*-*-- -*---*- *-----* ./xtreme Enter size: 11 *---*-*---* -*---*---*- --*-----*-- ---*---*--- *---*-*---* -*---*---*- *---*-*---* ---*---*--- --*-----*-- -*---*---*- *---*-*---* ./xtreme Enter size: 13 *---*---*---* -*---*-*---*- --*---*---*-- ---*-----*--- *---*---*---* -*---*-*---*- --*---*---*-- -*---*-*---*- *---*---*---* ---*-----*--- --*---*---*-- -*---*-*---*- *---*---*---* ./xtreme Enter size: 17 *---*---*---*---* -*---*-----*---*- --*---*---*---*-- ---*---*-*---*--- *---*---*---*---* -*---*-----*---*- --*---*---*---*-- ---*---*-*---*--- *---*---*---*---* ---*---*-*---*--- --*---*---*---*-- -*---*-----*---*- *---*---*---*---* ---*---*-*---*--- --*---*---*---*-- -*---*-----*---*- *---*---*---*---*
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
