pai tu ai facut un caz particular si de aia merge pt n=5. cam asa arata rezolvarea corecta (sau mrg una dintre ele) si merge pentru orice n
#include <iostream>
using namespace std;
int main()
{
unsigned n, i, j;
char a[100][100];
cin>>n;
for(i=1; i<=n; i++)
for(j=1; j<=n; j++)
if(i+j>n+1 && i<j)
a[i][j]='#';
else if(i+j<n+1 && i>j)
a[i][j]='#';
else
a[i][j]='*';
for(i=1; i<=n; i++)
{
for(j=1; j<=n; j++)
cout<<a[i][j]<<" ";
cout<<endl;
}
return 0;
}