number <- 13
  factorial <- 1
  
      for(i in 1:number) 
        {
          factorial = factorial * i
        }
  
  msg <- paste("Factorial of " , number , "is" , factorial)
  print(msg)
## [1] "Factorial of  13 is 6227020800"
  number <- 13
  factorial <- 1
  
  i <- 1
  
  while (i <= number) 
    {
      factorial = factorial * i
      i <- i + 1
    }
  
  msg <- paste("Factorial of " , number , "is" , factorial)
  print(msg)
## [1] "Factorial of  13 is 6227020800"

Exercise #2 Show how to create a numeric Vector

  numberic_vector <-  seq(10, 50, by=5)
  print(numberic_vector)
## [1] 10 15 20 25 30 35 40 45 50

Exercise #3

  lines <- function() 
  {
    x1 <- as.integer(readline(prompt="Please enter x1: "))
    y1 <- as.integer(readline(prompt="Please enter y1: "))
    x2 <- as.integer(readline(prompt="Please enter x2: "))
    y2 <- as.integer(readline(prompt="Please enter y2: "))
    
    distance <- ((((x2-x1)**2) + ((y2-y1)**2) )**.5)
    
    msg <- paste("The Distance is " , format(round(distance, 2), nsmall = 2))
    print(msg)
    
    slope <- (y2- y1) / (x2 - x1)
    
    msg <- paste("The slope is " , slope)
    print(msg)
    
    y_intercept <- y1 - (slope * x1)
    
    msg <- paste("The y-intercept is " , y_intercept, "-> ( 0,", y_intercept,")")
    print(msg)
 
  }
  
  lines()
## Please enter x1: 
## Please enter y1: 
## Please enter x2: 
## Please enter y2: 
## [1] "The Distance is  NA"
## [1] "The slope is  NA"
## [1] "The y-intercept is  NA -> ( 0, NA )"