Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define NCOL (4)
- #define NRIG (4)
- int main(){
- int mat[NRIG][NCOL];
- int i, j;
- for (i = 0; i < NRIG; i++) {
- for (j = 0; j < NCOL; j++)
- if (i==j){
- mat[i][j] = 1;
- }
- else{
- mat[i][j] = 0;
- }
- }
- for (i = 0; i < NRIG; i++) {
- for (j = 0; j < NCOL; j++) {
- printf("%d ", mat[i][j]);
- }
- putchar('\n');
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement