Răspuns:
#include <iostream>
using namespace std;
int main()
{
int n,i,j;
cin >> n;
cout << "matricea rezultat:" << endl;
for (i=1; i<=n; i++)
{
for (j=1; j<=n; j++)
{
if (j<i) cout << j << " ";
else cout << i << " ";
}
cout << endl;
}
return 0;
}
Explicație: