#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;
printf("conteudo 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 Principal\n");
for (i=0;i<L;i++)
{
printf("\n");
for(j=0;j<C;j++)
{
if(i==j)
{
printf("%d",mat[i][j]);
}
printf("\t");
}
}
return 0;
}
Nenhum comentário:
Postar um comentário