Square Problem in c++

1 2 3 4 5
2 2 3 4 5
3 3 3 4 5
4 4 4 4 5
5 5 5 5 5

How I am solve it?
I am done algorithm but code is not correct.

#include
using namespace std;
int main () {
int n, i, j;
cin >> n;

for(i=1; i<=n; i++)
{
	for(j=1; j<=n; j++)
	{
		if(i==1 || j==1)
			cout << "1 ";
		else if(i==2 || j==2)
			cout << "2 ";
		else if(i==3 || j==3)
			cout << "3 ";
		else if(i==4 || j==4)
			cout << "4 ";
		else
			cout << "5 ";
	}
	cout << endl;
}
return 0;

}