Nguyễn Văn Nhật
New member
What will be the output of the following R code?
A. 32
B. 42
C. 52
D. 46
Code:
> f <- function(num) {
+ hello <- "Hello, world!\n"
+ for(i in seq_len(num)) {
+ cat(hello)
+ }
+ chars <- nchar(hello) * num
+ chars
+ }
> meaningoflife <- f(3)
> print(meaningoflife)
B. 42
C. 52
D. 46