Skip to content

Instantly share code, notes, and snippets.

@ahoulgrave
Last active December 22, 2015 19:59
Show Gist options
  • Save ahoulgrave/6523129 to your computer and use it in GitHub Desktop.
Save ahoulgrave/6523129 to your computer and use it in GitHub Desktop.
Matriz de 5x5...
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int m[5][5] = {
{1,2,3,4,5},
{6,7,8,9,10},
{11,12,13,14,15},
{16,17,18,19,20},
{21,22,23,24,25}
};
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
if (j == 4-i || j == i) {
printf("%d",m[i][j]);
} else {
printf("0");
}
printf("\t");
}
printf("\n");
}
system("PAUSE");
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment