fork download
  1. M <- matrix(c(2, 5, 6, 1, 8, 10, 9, 4, 7), nrow = 3, byrow = TRUE)
  2.  
  3. M1 <- cbind(M, c(3, 4, 1))
  4. M2 <- cbind(c(7, 4, 5), M)
  5. sum_matrix <- M1 + M2
  6. prod_matrix <- M1 * M2
  7.  
  8. M
  9. M1
  10. M2
  11. sum_matrix
  12. prod_matrix
  13.  
Success #stdin #stdout 0.26s 40800KB
stdin
Standard input is empty
stdout
     [,1] [,2] [,3]
[1,]    2    5    6
[2,]    1    8   10
[3,]    9    4    7
     [,1] [,2] [,3] [,4]
[1,]    2    5    6    3
[2,]    1    8   10    4
[3,]    9    4    7    1
     [,1] [,2] [,3] [,4]
[1,]    7    2    5    6
[2,]    4    1    8   10
[3,]    5    9    4    7
     [,1] [,2] [,3] [,4]
[1,]    9    7   11    9
[2,]    5    9   18   14
[3,]   14   13   11    8
     [,1] [,2] [,3] [,4]
[1,]   14   10   30   18
[2,]    4    8   80   40
[3,]   45   36   28    7