my code stock.com

Aangeel Feernaandeez

esquinas de una matriz 1.0
by Aangeel Feernaandeez

Programa 41

Snippet options

Download: Download snippet as esquinas-de-una-matriz-10.c.
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();
int main()
{
	system("Color 4b");
	printf("\nPrograma que imprima los elementos de las esquinas de la matriz");
	leermatriz();
	imprimirmatriz();

}
void leermatriz()
{
	int matriz[50][50];
	int fila, columna,i,j;
	printf("\nLectura de matriz");
	do{printf("\nDame la cantidad de fila=>");
	scanf("%d",&fila);
	printf("Dame la cantidad de columnas=>");
	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");
	
}
void imprimirmatriz()
{
	int matriz[50][50];
	int fila, columna,i,j;
	printf("\nEsquinas de la matriz");
	for(i=0;i<=fila-1;i++){
		printf("\n");
		for(j=0;j<=columna-1;j++){
			if((i==0||i==fila-1)&&(j==0||j==columna-1)){
				system("color 1a");
			printf("\t%d",matriz[i][j]);
			}
		}
	}
	system("pause");
}

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!

Find out more and register now

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