1. Write a loop that calculates 12-factorial
print (paste("This calculates the factorial of the number 12"))
## [1] "This calculates the factorial of the number 12"
myfactorial <- 1

for (i in 1:12) {
  myfactorial <- myfactorial*i
}

print (paste("The factorial of 12 is", myfactorial))
## [1] "The factorial of 12 is 479001600"

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

#First method of creating a vector

x <- c(20, 25, 30, 35, 40, 45, 50)

print (x)
## [1] 20 25 30 35 40 45 50
#Second method of creating a vector 

x2 <- seq(20,50,5) #(starting nbr, ending nbr, interval)

print (x2)
## [1] 20 25 30 35 40 45 50

3.Create the function “quadratic” that takes a trio of input numbers a, b,and c and solve the quadratic equation. The function shoul print as output the two solutions.

# Quadratic equation y = ax^2 + bx + c

#set values for a, b and c
a <- 3
b <- 5
c <- 1

myfunctionq <- function(a, b, c)
{ 

   x <- a*x^2 + b*x + c

  print (x)  
}  

I am stuck on this problem.