##R HW Week 1 ##David Blumenstiel

1. Write a loop that calculates 12-factorial

x<-1

for (i in 1:12) {
  x = x * i
 
}
print(x)
## [1] 479001600

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

vec <- seq(20, 50, 5)
print(vec)
## [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 should print as output the two solutions.

a <- 5
b <- 10
c <- 4
result1<-(-b-sqrt((b^2)-4*a*c))/(2*a)
result2<-(-b+sqrt((b^2)-4*a*c))/(2*a)
cat('result 1: ', result1)
## result 1:  -1.447214
cat('result 2: ', result2)
## result 2:  -0.5527864