my logic for solving this question is correct but it fails the test cases, please check it weather i has any mistakes andI fixed space still showing wrong answer. i atteched my code below… #include using namespace std; int main() { // declare variables int row, i, j, k; // take input cout << "Enter the number of rows: "; cin >> row; // new line cout << “\n”; // display the pattern for (i = row; i >= 1; i–) { for (j = 1; j <= i - 1; j++) { cout << " "; } // for the first and last rows if (i == 1 || i == row) { for (k = 1; k <= row; k++) { cout << “"; } } // for the other rows else { for (k = 1; k <= row; k++) { // for the first and last columns if (k == 1 || k == row) { cout << "”; } else { cout << " "; } } }
Hollow Rhombus Pattern
Hi! To find out what I can do, say @discobot display help
.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.