1. Find 12 factorial

Below is the program

factorial <- function(x) {
if x<=0 {
  return 0
}
  
  fact <- 1
  for (i in 1:x) {
    fact <- fact * i
  }
  sprintf("Factorial of %d is %d ",x,fact)
  return fact
}

factorial(12)

2. Create a numeric vector containing numbers from 20 to 50 in a sequence of 5

print(seq(from = 20, to = 50, by = 5))