my_factorial <- function(){
  # input here is 12
  val = 12
  res = 1
  # checking whether the number is negative, zero or positive
  if(val < 0) {
    print(" Factorial does not exist for such numbers. ")
  } else if(val == 0) {
    print(" The factorialof 0 is 1 ")
  } else {
    for( i in 1:val) {
      res = res * i
    }
    print(paste(" The factorial result is ", val ,"is", res ))
  }
}
my_factorial()
## [1] " The factorial result is  12 is 479001600"