Answer the question
In order to leave comments, you need to log in
Can you suggest how to do this (square matrix)?
Create and display a matrix of the form:
1 2 3 4 5
2 3 4 5 1
3 4 5 1 2
4 5 1 2 3
5 1 2 3 4
Answer the question
In order to leave comments, you need to log in
int matrix[5][5] = {
{1,2,3,4,5},
{2,3,4,5,1},
{3,4,5,1,2},
{4,5,1,2,3},
{5,1,2,3,4}
};
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 5; j++)
{
std::cout << matrix[i][j] << " ";
}
std::cout << std::endl;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question