#include <stdio.h>
#include <stdlib.h>
#include<conio.h>
#define L 5
#define C 5
int main()
{
int mat[L][C]={{1,2,3,4,20},{5,6,7,8,21},{9,10,32,11,22},{12,13,14,15,23},{16,17,18,19,24}};
int i,j,num,contsec=C,espaco;
printf("\n\nconteudo da matriz:\n\n");
for (i=0;i<L;i++)
{
for(j=0;j<C;j++)
{
printf("%d",mat[i][j]);
printf("\t");
}
printf("\n");
}
printf("\n\nDiagonal secundaria\n");
for (i=0;i<L;i++)
{
contsec--;
printf("\n");
for(j=C-1;j>=0;j--)
{
if(contsec==j)
{
printf("%d",mat[i][j]);
}
}
}
getch();
return 0;
}
Nenhum comentário:
Postar um comentário