# Initialize the result result <- 1 # Number to calculate factorial num <- 12 # Loop from 1 to the number for(i in 1:num){ result <- result * i } # Print the result print(result)
## [1] 479001600