SHARE
TWEET

Untitled

a guest May 19th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #define NCOL (4)
  5. #define NRIG (4)
  6.  
  7. int main(){
  8.     int mat[NRIG][NCOL];
  9.  
  10.     int i, j;
  11.  
  12.     for (i = 0; i < NRIG; i++) {
  13.         for (j = 0; j < NCOL; j++)
  14.             if (i==j){
  15.                 mat[i][j] = 1;
  16.             }
  17.             else{
  18.                 mat[i][j] = 0;
  19.             }
  20.     }
  21.  
  22.     for (i = 0; i < NRIG; i++) {
  23.         for (j = 0; j < NCOL; j++) {
  24.             printf("%d ", mat[i][j]);
  25.         }
  26.         putchar('\n');
  27.     }
  28.  
  29.  
  30.     return 0;
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top