Rombo Matriz

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

#include <iostream>

#include <stdlib.h>
#include <conio.h>

#define m 5

using namespace std;

int main()
{ int i,j,a=-1;
int M[m][m];

for (i=0;i<=m-1;i++)
for (j=0;j<=m-1;j++)
{printf ("elemento %d,%d : ",i,j);
scanf("%d",&M[i][j]);
}

for (i=0;i<=m-1;i++)
{if (i>(m/2)) a--;
else a++;
for (j=(m/2)-a;j<=(m/2)+a;j++) printf("%d",M[i][j]);
printf("\n");
}

getch();
return 0;
}

You might also like