samedi 18 septembre 2021

C++ program to print hollow rectangle star pattern

I would like to know where I am going wrong. I know the logic is correct. Output of code

for (i = 1; i <= rows; i++) {
    for (j = 1; j <= columns; j++) {
        if (i == 1 || i == rows || j == 1 || j == columns) {
            cout << "*";
        }
        else {
            cout << "";
        }
        
        }
        cout << endl;
    }
    

Aucun commentaire:

Enregistrer un commentaire