👤

Programul functioneaza doar daca matricea are cu o linie si o coloana in plus adica este de 6x6 in loc de 5x5


Aveti idee de ce?


#include

using namespace std;

int main()
{
int a[6][6];
for(int i=1;i<=5;i++)
{
for(int j=1;j<=5;j++){
if(i==1&&j==1)a[i][j]=1;
else{
if(j>1) a[i][j]=a[i][j-1]+1;
else a[i][j]=a[i-1][5]+1;
}

}}
for(int i=1;i<=5;i++)
{

for(int j=1;j<=5;j++)
cout< cout< }
return 0;
}