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
CalFactorial<- function(x){
  num<-1
  for(count in 1:x){
  num<-num*((1:x)[count])
  }
  print(num)
}
CalFactorial(12)
## [1] 479001600
  1. Show how to create a numeric vector that contains the sequence from 20 to 50 by 5.
x<-seq(20, 50, 5)
x
## [1] 20 25 30 35 40 45 50
  1. Create the function “factorial” 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. Find solution for function ax^2+bx+c=0 using quaration equation to find two solutions x1 and x2
result<-function(a,b,c){
  
  x1<-((-b)+sqrt((b^2)-4*a*c))/(2*a)
  print(x1)
  
  x2<-((-b)-sqrt((b^2)-4*a*c))/(2*a)
  print(x2)
  
}
result(1,5,4)
## [1] -1
## [1] -4