This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
fac <- 1
for (i in 12:1){
if(i >0)
{
fac <- fac * i
}
}
print(fac)
fives <- seq(20,50,5)
fives
factorial <- function(){
a.num<- readline(prompt = "Enter A variable of quadratic equation: ")
b.num<- readline(prompt = "Enter B variable of quadratic equation: ")
c.num<- readline(prompt = "Enter C variable of quadratic equation: ")
a.num <- as.integer(a.num)
b.num <- as.integer(b.num)
c.num <- as.integer(c.num)
factp <- (- b.num + sqrt(b.num ^ 2 - 4 * a.num * c.num)) / 2 * a.num
factm <- (- b.num - sqrt(b.num ^ 2 - 4 * a.num * c.num)) / 2 * a.num
sprintf ("X values are %s and %s", factp, factm)
}