0
R - rangeSum
The code to the problem is not getting resolved: Always gives the error input <- readLines('stdin') x <- as.integer(input[1]) y <- as.integer(input[2]) #define the function rangeSum <- function(a,b){ sum <- 0 for (i in a:b) { sum <- sum + i } return sum } result <- rangeSum(x, y) print(result)
1 Resposta
+ 2
Note that it is
return(sum), not
return sum