1 Write a loop that calculates 12 Factorial

FacLoop<-1
for (x in 1:12) {
if(x==1) Facloop<-1
else {
  Facloop<-Facloop*x
  }
cat(x, "!:",Facloop, "\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

2 Show how to create a numeric vector that contains the sequence from 20 to 50 by 5

NumerVec<-seq(20,50,by=5)
is.vector(NumerVec,mode=
          "numeric")
## [1] TRUE
NumerVec
## [1] 20 25 30 35 40 45 50

3 Create the function “Factorial” that takes a trio of input numbers A, B and C and solve the quadratic equation. The function should print as output the two solutions

EquationSolver <- function(a, b, c) {
  
  EquationVec <-b^2-2*a*c
    ans1 <- (-b+2*a*c)/(a)
    ans2 <- (-b-2*a*c)/(a)
    x <- c(ans1, ans2)
    x
}
#sample input
EquationSolver(2,2,2)
## [1]  3 -5
EquationSolver(1,5,10)
## [1]  15 -25
EquationSolver(2,14,12)
## [1]  17 -31
EquationSolver(20,25,5)
## [1]   8.75 -11.25