#Accepted CUNY admission last week and was granted bridge course access yesterday (7/21/2020). I will review course material and complete assignments on my own to better prepare for the start of the MSDS program late in August.

###Start of Assignment###

#1. Write a loop that calculates 12-factorial

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

#2. Create a numeric vector that contains a sequence from 20 to 50 by 5.

numVec <- as.numeric(seq(20, 50, by = 5))

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

#Used the following site for guidance: https://rpubs.com/kikihatzistavrou/80124

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

if(b^2-4ac > 0){ #1st case D>0 x1 = (-b+sqrt(b^2-4ac))/(2a) x2 = (-b-sqrt(b^2-4ac))/(2a) result = c(x1,x2) }

else if(b^2-4ac == 0){ #2nd case D=0 result = -b/(2*a) }

else { result =“No real roots.” } #3rd case D<0

}

###End of Assignment###