Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MATRICES TRIANGULARES
#include <stdio.h> #include <stdbool.h> int main(void) { unsigned short N; // 'N' representará la dimensión de la matriz cuadrada. unsigned short valor; unsigned short i, j; while (true) { // Ingreso de la dimensión de la matriz cuadrada. scanf("%hu", &N); // Validar si el proceso continuará o terminará if (N == 0) break; valor = 1; short matriz[N][N]; short *numero = (short *) matriz; // Ingreso de números en la matriz for (i = 0 ; i < N*N ; i++) scanf("%hi", numero + i); //numero = (short *) matriz; // Iteración para comprobar si la matriz es triangular superior. for (i = 0 ; i < N - 1 ; i++) { for (j = i + 1 ; j < N ; j++) { if (matriz[i][j] != 0) { valor = 0; break; } } if (valor == 0) break; } if (valor == 1) printf("SI\n"); else { valor = 1; for (i = 1 ; i < N ; i++) { for (j = 0 ; j < i ; j++) { if (matriz[i][j] != 0) { valor = 0; break; } } if (valor == 0) break; } if (valor == 1) printf("SI\n"); else printf("NO\n"); } } return 0; }
run
|
edit
|
history
|
help
0
date diff sample
linkedlist
cstructCensus
Stack frame enum test
1, 2, 3, & 4-layer neural networks in C
upper case letter.c
ordenarcifrademenosamas
Encriptado cesar
18BCE2182 LAB FAT-2(A)-(i)
888 BONUS LAB 1