for (x in 1:12){
# browser()
if(x == 1) inPvec <- 1
else {
inPvec <- inPvec * x
}
cat(x, "!:", inPvec, "\n")
}
## 1 !: 1
## 2 !: 2
## 3 !: 6
## 4 !: 24
## 5 !: 120
## 6 !: 720
## 7 !: 5040
## 8 !: 40320
## 9 !: 362880
## 10 !: 3628800
## 11 !: 39916800
## 12 !: 479001600
nVec <- seq(20, 50, by = 5)
is.vector(nVec, mode = "numeric")
## [1] TRUE
QFun <- function(a, b, c) {
numSqrt <- b^2 - 4*a*c
if(numSqrt > 0) {
x1 <- (-b+sqrt(b^2 - 4*a*c))/(2*a)
x2 <- (-b-sqrt(b^2 - 4*a*c))/(2*a)
x <- c(x1, x2)
x
} else if (numSqrt == 0) {
x <- -b/(2*a)
x
} else {"No results when the number under square root less than 0."}
}
QFun(100,-478,50)
## [1] 4.6730024 0.1069976