##1.Write a loop that calculates 12-factorial

factor = 1
for(i in 12:1)
{
factor = factor*i
}

cat(paste("The Factorial of 12:", factor))
## The Factorial of 12: 479001600

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

seq(from = 20, to = 50, by = 5)
## [1] 20 25 30 35 40 45 50

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

factorial <-function(a, b, c)
{
  sol1=(-b+(b^2 - 4*a*c)^(1/2))/(2*a)
  sol2=(-b-(b^2 - 4*a*c)^(1/2))/(2*a)
  cat(paste("\n Solution Number 1 is ", sol1))
  cat(paste("\n Solution Number 2 is ", sol2))
  cat(paste("\n If Solution is NaN then solutions are complex\n"))
 }
factorial(6, 15, 5)
## 
##  Solution Number 1 is  -0.396087436170034
##  Solution Number 2 is  -2.10391256382997
##  If Solution is NaN then solutions are complex