Advertisement
Guest User

Untitled

a guest
May 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement