max <- 0
for(i in 1:1000){
x1 <- runif(1:10, 1)
x2 <- runif(1:10, 1)
x3 <- runif(1:10, 1)
z <- (exp(x1)+x2)^2 + (3(1-x3)^2)
if(z > max)
max <- z
}
print(max)
This has to print maximum number between 1 to 10000 and 'z' is the formula.
I am getting error "Error: attempt to apply non-function".