Write a loop that calculates 12-factorial

factorial <- function(x){ y <- 1 for(iin 1:x){ y <-y*((1:x)[i]) print(y) }}

factorial (12) [1] 1 [1] 2 [1] 6 [1] 24 [1] 120 [1] 720 [1] 5040 [1] 40320 [1] 362880 [1] 3628800 [1] 39916800 [1] 479001600

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

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

a <- 2 b <- 1 c <- 4

(-b + (sqrt(b ^ 2 - 4 * a * c)))/(2 * a) (-b - (sqrt(b ^ 2 - 4 * a * c)))/(2 * a)