title: “W1 HW” output: html_notebook

get_factorial<- function(n=0){
  if(n<0) return (-1)
if(n==0) return (1)
my_factorial<- 1
for(i in 1:n){
  my_factorial<-my_factorial*i
}
 return (my_factorial)
}
get_factorial(12)
## [1] 479001600


```r
five_vector<- c(seq.int(20,50, by=5))
five_vector
## [1] 20 25 30 35 40 45 50

```r
quad <- function(a,b,c){
if(discriminant(a,b,c) > 0){ 
x_1 = (-b+sqrt(discriminant(a,b,c)))/(2*a)
x_2 = (-b-sqrt(discriminant(a,b,c)))/(2*a) 
result = c(x_1,x_2)
}
else if(discriminant(a,b,c) == 0){
x = -b/(2*a) }
else {"There are no real roots."} 
} 
discriminant<-function(a,b,c){
b^2-4*a*c
}
c1=quad(1,2,1)
c1
## [1] -1
c2=quad(1,6,5)
c2
## [1] -1 -5
c3=quad(1,1,1)
c3
## [1] "There are no real roots."

```