# programa 37 by Aangeel Feernaandeez

unidimensional

### Snippet options

Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

```#include<stdio.h>
#include<windows.h>
void leermatriz();
void imprimirmatriz();
void imprimirdiagonales();
int fila, columna,i,j;
int matriz[50][50];
int main()
{
printf("\nPrograma 37 que imprima los elementos de las diagonales en un arreglo unidimensional");
leermatriz();
imprimirmatriz();
imprimirdiagonales();
}
void leermatriz()
{
printf("\nLectura de matriz");
scanf("%d",&fila);
scanf("%d",&columna);
if(fila!=columna)
{
printf("\nNumero de filas debe ser igual al de columnas");
}
}while(fila!=columna);
for(i=0;i<fila;i++){
for(j=0;j<columna;j++){
printf("\nDame el valor de la casilla[%d][%d]",i,j);
scanf("%d",&matriz[i][j]);
}
}
system("pause");
return;
}
void imprimirmatriz()
{
printf("\nMatriz");
for(i=0;i<fila;i++){
printf("\n");
for(j=0;j<columna;j++){
printf("\t%d",matriz[i][j]);
}
}
system("pause");
return;
}
void imprimirdiagonales()
{

printf("\nElemnetos de las diagonales");
for(i=0;i<fila;i++){
for(j=0;j<columna;j++){
if(i+j==fila-1||i==j)
{
printf("\n%d",matriz[i][j]);
}

}
}
system("Pause");
return;
}
```

### Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.