0
Where is the error ?
The given code takes a number as input, passes it to a square() function, and assigns the result to a variable, which is then printed. Define a square function, which takes a parameter and returns its square, so the code works as expected. x <- readLines('stdin') x <- as.integer(x[1]) square (x) <- x*x result <- square(x) print(result)
1 ответ
+ 7
You must define "square" as a function.
Here square as a function. It must be work. I hope, it helps. Happy coding!
x <- readLines('stdin')
x <- as.integer(x[1])
square <- function(x){
return <- x*x
}
result <- square(x)
print(result)