+ 1
Write a program to print the following pattern!!!!!
***** * * * * *****
1 Answer
+ 4
int main() {
const unsigned int RECT_W = 5;
const unsigned int RECT_H = 4;
for (int i = 0; i < RECT_H; i++) {
for (int j = 0; j < RECT_W; j++) {
if ((i > 0 && i < RECT_H - 1) && (j > 0 && j < RECT_W - 1)) {
cout << " ";
} else {
cout << "*";
}
}
cout << endl;
}
return 0;
}