‘Please create the following exercises in .rmd format, publish to rpub and submit both the .rmd file and the rpub link. 1. Write a loop that calculates 12-factorial 2. Show how to create a numeric vector that contains the sequence from 20 to 50 by 5. 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.’
factorial = 1 for (i in 1:12) { factorial = factorial*i
}
print(paste(“12! equals…”, factorial))
x0 = 20 seq(x0, 50, 5)
quad_form <- function(a,b,c) {
disc <- sqrt(b^2 - (4ac)) first_root <- (b-1 + disc)/(2a) second_root <- (b-1 - disc)/(2a)
print(first_root) print(second_root)
}
quad_form(1,2,3)