Skip to content

Instantly share code, notes, and snippets.

@kaline
Created February 23, 2023 02:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaline/ae7476e4be93067bbe8dbe005b5c7c08 to your computer and use it in GitHub Desktop.
Save kaline/ae7476e4be93067bbe8dbe005b5c7c08 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#define linha 6
#define coluna 6
int printMatrixInvertida(int mat[linha][coluna]){
for(int i=0; i<linha;i++){
for(int j=0;j<coluna;j++){
if(i+j < linha-1){
printf(" %d ", mat[i][j]);
}
else{
printf(" * ");
}
}
printf("\n ");
}
}
int printMatrixInvertidaInferior(int mat[linha][coluna]){
for(int i=0; i<linha;i++){
for(int j=0;j<coluna;j++){
if(i+j > linha-1){
printf("%d ", mat[i][j]);
}
else{
printf(" * ");
}
}
printf("\n ");
}
}
int main(){
int mat[linha][coluna] = {
3,3,4,1,5,1,
6,0,5,5,6,6,
1,0,5,6,3,2,
8,9,6,7,9,9,
6,3,2,2,7,6,
9,1,6,6,0,9
};
printMatrixInvertida(mat);
printf("\n ");
printMatrixInvertidaInferior(mat);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment