my logic for solving this question is correct but it fails the test cases, please check it weather i has any mistakes
i atteched my code below.
#include <bits/stdc++.h>
using namespace std;
int main() {
int number;
cin>> number;
for (int i=0; i < number; i++)
{
for (int j=0; j < number - i; j++)
cout << " ";
for (int j=0; j < number; j++)
{
if (i == 0 || i == number-1 || j == 0 || j == number-1)
cout << โ*โ ;
else
cout << " " ;
}
cout << endl ;
}
return 0;
}