#task 01 (a)
(5*4)^(4*5)-56
## [1] 1.048576e+26
#task 01 (b)
23-1*(8-12)
## [1] 27
#task 01 (c)
56/8*(3+4)
## [1] 49
#task 01 (d)
45-5*8+(8+9)
## [1] 22
#create the vectors
Vector1 <- c(2,5,6,7)
Vector2 <- c(1,0,9,8)
Vector3 <- c(6,5,8,3)
#create the matrix by row binding the vectors
attendance_matrix <- rbind(Vector1, Vector2, Vector3)
#set column names
colnames(attendance_matrix) <- c("Mon", "Tue", "Wed", "Thu")
#set the row names
rownames(attendance_matrix) <- c("Present", "Absent", "On leave")
#print the matrix
print(attendance_matrix)
## Mon Tue Wed Thu
## Present 2 5 6 7
## Absent 1 0 9 8
## On leave 6 5 8 3
#calculate row sums
row_sums <- rowSums(attendance_matrix)
print(row_sums)
## Present Absent On leave
## 20 18 22
#calculate column sums
col_sums <- colSums(attendance_matrix)
print(col_sums)
## Mon Tue Wed Thu
## 9 10 23 18